- to say that it does not work; or
- to say that whatever it does defines what it is intended to do, like spilling a bunch of paint on a canvas and then saying that whatever results is what the painting was intended to be.
How does this code work?
2 次查看(过去 30 天)
显示 更早的评论
clear; close all;
%% settings
folder = 'test img';
scale = 4;
%% generate data
filepaths = dir(fullfile(folder,'*.bmp'));
for i = 1 : length(filepaths)
im_gt = imread(fullfile(folder,filepaths(i).name));
im_gt = modcrop(im_gt, scale);
im_gt = double(im_gt);
im_gt_ycbcr = rgb2ycbcr(im_gt / 255.0);
im_gt_y = im_gt_ycbcr(:,:,1) * 255.0;
im_l_ycbcr = imresize(im_gt_ycbcr, 1/scale, 'bicubic');
im_b_ycbcr = imresize(im_l_ycbcr, scale, 'bicubic');
im_l_y = im_l_ycbcr(:,:,1) * 255.0;
im_l = ycbcr2rgb(im_l_ycbcr) * 255.0;
im_b_y = im_b_ycbcr(:,:,1) * 255.0;
im_b = ycbcr2rgb(im_b_ycbcr) * 255.0;
filename = sprintf('test_img-output/%s.mat',filepaths(i).name);
save(filename, 'im_gt_y', 'im_b_y', 'im_gt', 'im_b', 'im_l_ycbcr', 'im_l_y', 'im_l');
end
5 个评论
Walter Roberson
2020-2-29
im_l_y = im_l_ycbcr(:,:,1) * 255.0; %white image
Not really white image, but rather luminance image. Close enough to grayscale for your purposes.
%imshow(im_l_y);
im_l = ycbcr2rgb(im_l_ycbcr) * 255.0; %get the rgb image from the above white image
No, we identified the single pane white image as being the luminance image stored into im_l_y, but this line is working with im_l_cbcr which is 3 pane. This is a bug in the implementation.
Which is why documentation and comments are really important. The first version did whatever it actually did, and that defined what it was intended to do.
回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!