# color image processing (3*240960 double)

조회 수: 1(최근 30일)
Malini Bakthavatchalam 2020년 7월 11일
댓글: Malini Bakthavatchalam 2020년 7월 12일
Hi, I have doubt, I am attaching code that my senior worked on to create illusion in gray levels. Now I am trying to make that work in color iimages. So, the one thing I noticed while debugging his code is 3*240960 double. He used only 3*240960 double form to find median from his axis and did the rectification required to create illusion only in this 3*240960 double. After doing all that he finally inversed the 3*240960 with the matrix to create a displayable RGB image. But why is that done like that? I was confused with his codes... for a long time. Because I did in my way to convert the image in desired color space and i was working on the RGB image. Which never gave my desired resullt. So I want to know why 3*240960 double is the way worked for him?
The below code is my code, that I did with the help of matlab answers section. The attached code is his code.
MyImrgb = reshape(im2double(RGB), [],3);
Imrgb = MyImrgb.^2.2; %gamma correction
[x, y, z] = size(Imrgb);
%% transform my picture in a DKL color space
% Define a DKL2RGB mat based on the classic calibration technic
% this P matrix defines DKL in RGB color space
%ld % rg %yv
ldrgyv2rgbMat = [1.0000 1.0000 0.236748566577269 %R
1.0000 -0.299338211934457 -0.235643322285071 %G
1.0000 0.0137437185685517 1]; % B
MyImrgbCol = reshape(Imrgb * ldrgyv2rgbMat, size(RGB));
MyImldrgyvCol = reshape(reshape(MyImrgbCol, [],3) *inv(ldrgyv2rgbMat),size(MyImrgbCol));
figure(1),imshow(MyImldrgyvCol)
figure (2);
plot3(MyImldrgyvCol(2,1:25:end),MyImldrgyvCol(3,1:25:end),MyImldrgyvCol(1,1:25:end),'r+'); hold on; % displaying the image in the 3 axis where the z axis is kept constant value displaced only on x and y axis
plot3([0 0], [-1 1], [0 0], 'k-','LineWidth', 2);
plot3([-1 1], [0 0], [0 0], 'k-','LineWidth', 2);
plot3([0 0], [0 0], [-1 1], 'k-','LineWidth', 2);
xlabel('LM'); ylabel('S'); zlabel('LD');
axis([-1 1 -1 1 -1 1])
vecx = -1 : 0.50 : 1; vecy = -1 : 0.50 : 1; vecz = -1 : 0.50 : 1;
grid on;
set(gca, ...
'XTick' , vecx , ...
'YTick' , vecy , ...
'ZTick' , vecz );
LMaxes1 = (MyImldrgyvCol(2,:));
MedLM = median(LMaxes1);
figure(3),imhist(LMaxes1)
figure(4),imhist(MyImldrgyvCol(2,:,:))
Thanks
##### 댓글 수: 3표시숨기기 이전 댓글 수: 2
Malini Bakthavatchalam 2020년 7월 12일
@Image Analyst , sir I am using the same code then why am I getting the same error ? could you explain me please.

댓글을 달려면 로그인하십시오.

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!