mirror of
https://github.com/RustyRaptor/learnopencv.git
synced 2026-12-03 22:15:16 -07:00
converted output images to uint8 explicitly before saving
This commit is contained in:
1 parent
12c9dc4533
commit
56b52c7728
2 files changed
+5
-2
No files matched your search
@@ -111,7 +111,10 @@ int main(int argc, char **argv)
|
||||
string str = imageFileName;
|
||||
str.replace(str.end()-4, str.end(), "");
|
||||
str = str+"_colorized.png";
|
||||
imwrite(str, color*255);
|
||||
|
||||
color = color*255;
|
||||
color.convertTo(color, CV_8U);
|
||||
imwrite(str, color);
|
||||
|
||||
cout << "Colorized image saved as " << str << endl;
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ img_lab_out = np.concatenate((img_l[:,:,np.newaxis],ab_dec_us),axis=2) # concate
|
||||
img_bgr_out = np.clip(cv.cvtColor(img_lab_out, cv.COLOR_Lab2BGR), 0, 1)
|
||||
|
||||
outputFile = args.input[:-4]+'_colorized.png'
|
||||
cv.imwrite(outputFile, img_bgr_out*255)
|
||||
cv.imwrite(outputFile, (img_bgr_out*255).astype(np.uint8))
|
||||
print('Colorized image saved as '+outputFile)
|
||||
print('Done !!!')
|
||||
|
||||
Reference in new issue
Block a user