matrix manipulation for color spaces.

조회 수: 6 (최근 30일)
Malini Bakthavatchalam
Malini Bakthavatchalam 2020년 5월 19일
댓글: Malini Bakthavatchalam 2020년 5월 25일
Hi , I have an image . I want to convert that to [3 3] matrix value to play with color space. I understand imead will convert image to matrix form but if I want 3 3 matrix, How should I proceed?
  댓글 수: 2
darova
darova 2020년 5월 19일
Can you explain more? What size of your image? And what kind of conversion you want?
Malini Bakthavatchalam
Malini Bakthavatchalam 2020년 5월 19일
tVersion: ''
Width: 480
Height: 502
BitDepth: 24
ColorType: 'truecolor'
FormatSignature: ''
NumberOfSamples: 3
This is my image size. The image is just a face of a girl. So I want to convert this image in DKL space and work on illusion project.

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

채택된 답변

Walter Roberson
Walter Roberson 2020년 5월 19일
편집: Walter Roberson 2020년 5월 19일
You probably do not want a 3 x 3 images. What you probably want is to let T be a 3 x 3 transformation matrix, and RGB be your RGB image, then
M = reshape(RGB, [], 3);
transformed = M * T;
nonRGB = reshape(transformed, size(RGB));
  댓글 수: 26
Malini Bakthavatchalam
Malini Bakthavatchalam 2020년 5월 25일
Yes, thank you I got your point, so I wrote my final code for converting into DKL color space back into RGB..
clear all
close all
clc
RGB = imread('file.jpg')
MyImrgb = reshape(im2double(RGB), [],3);
Imrgb = MyImrgb.^2.2; %gamma correction
[x, y, z] = size(Imrgb);
ldrgyv2rgbMat = [1,1,0.236748566577269;
1,-0.299338211934457,-0.235643322285071;
1,0.0137437185685517,1]; % B (mat based on the classic calibration technic)
MyImrgbCol = reshape(Imrgb, [x*y, z]);
MyImldrgyvCol = ldrgyv2rgbMat\(MyImrgbCol'*2 - 1);
figure(1), imshow(RGB)
figure(2), imshow(MyImldrgyvCol)
But i get error
Error using \
Matrix dimensions must agree.
Error in dkltry2 (line 12)
MyImldrgyvCol = ldrgyv2rgbMat\(MyImrgbCol'*2 - 1);
Malini Bakthavatchalam
Malini Bakthavatchalam 2020년 5월 25일
Also, I have one more doubt, I used an color thresholder to remove my background. and I used that image in the color space transformation. but now when I use my complete code for the project, it is still calculating my histogram with background so how can i solve the issue.. I am attaching my complete code here

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Convert Image Type에 대해 자세히 알아보기

제품


릴리스

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by