MATLAB Answers

Error using hsv2rgb (line 59) MAP must be a Mx3 array. Error in hsvdwt (line 35) rgbimg=hsv2rgb(hsvimg);

15 views (last 30 days)
shivu shetty
shivu shetty on 31 Mar 2018
Commented: Walter Roberson on 31 Mar 2018
ima=imread('w4.jpg'); HSV=rgb2hsv(ima); H=HSV(:,:,1); S=HSV(:,:,2); V=HSV(:,:,3); SE = strel('line',11,90); H = imdilate(H,SE); S = imdilate(S,SE); V = imdilate(V,SE); [hca1,hch1,hcv1,hcd1] = dwt2(H,'bior1.3'); [sca1,sch1,scv1,scd1] = dwt2(S,'bior1.3'); [vca1,vch1,vcv1,vcd1] = dwt2(V,'bior1.3');
LH=hch1+hcv1+hcd1; LS=sch1+scv1+scd1; LV=vch1+vcv1+vcd1;
%a=idwt2(LH,hch1,hcv1,hcd1,'bior1.3'); %figure,imshow(a); %b=idwt2(LS,sch1,scv1,scd1,'bior1.3'); %figure,imshow(b); %c=idwt2(LV,vch1,vcv1,vcd1,'bior1.3'); %figure,imshow(c); %hsvimg=a+b+c; a=LH+LS+LV; h=hch1+sch1+vch1; v=hcv1+scv1+vcv1; d=hcd1+scd1+vcd1;
hsvimg=idwt2(a,h,v,d,'bior1.3'); figure,imshow(hsvimg); title('reconstructed image');
rgbimg=hsv2rgb(hsvimg); figure,imshow(rgbimg); title('reconstructed rgb image');

  1 Comment

Walter Roberson
Walter Roberson on 31 Mar 2018
I suspect that you are getting a 2D array at that point. Typically you need to reconstruct the channels separately and put them together to get a 3d array suitable for hsv2rgb

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!