Info
이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.
How to solve error for Non-cell array object.?
조회 수: 1 (최근 30일)
이전 댓글 표시
I have one matrix " 1350x1800x3 double " value named ret When i run im_desat = ret{1}; it shows error
Cell contents reference from a non-cell array object.
Error in main (line 37)
im_desat = ret{1};
How to overcome it.? With this value i have to further proceed with following program.!
im_desat = ret{1};
desat_map = ret{2};
subplot(2,2,3); imshow(desat_map); title('desaturation map');
subplot(2,2,4); imshow(im_desat); title('desaturated image');
print(f, '-dpdf', [fname '_desat.pdf']);
%%object segmentation
f = figure(3); subplot(2,2,1); imshow(im); title('original');
subplot(2,2,2); imshow(res); title('saliency map');
binary_saliency_map = res>graythresh(res);
map_segmented = segmentation(res)
subplot(2,2,3); imshow(binary_saliency_map); title('binary saliency map');
subplot(2,2,4); imshow(map_segmented); title('segmented');
print(f, '-dpdf', [fname '_seg.pdf']);
%%fake 3D
im = uint8(im_desat * 255);
background = im.*repmat((1- uint8(map_segmented)), [1 1 3]);
foreground= im.*repmat((uint8(map_segmented)), [1 1 3]);
%%shift the background
shift = 2;
background(:,1:end-shift,:) = background(:,shift +1:end,:);
map_segmented_shifted = map_segmented;
map_segmented_shifted(:,1:end-shift) = map_segmented_shifted(:,shift +1:end);
map_diff = map_segmented_shifted & ~ map_segmented;
map_diff_rgb = repmat(map_diff, [1 1 3]);
background(map_diff_rgb) = im(map_diff_rgb);
subplot(2,2,1); imshow(map_diff);
figure(4); subplot(2,2,3); imshow(background);
map_diff_i = ~map_segmented_shifted & map_segmented;
map_diff_rgb_i = repmat(map_diff_i, [1 1 3]);
background(map_diff_rgb_i) = 0;
result = background + foreground;
subplot(2,2,4); imshow(result);
%%play video
%{
figure(5);
for i = 1:1
imshow(im);
%pause(.2);
%imshow(result);
%pause(.2);
end
%}
figure(17);
filename = [fname '_3D.gif'];
imshow(im); drawnow;
[imind,cm] = rgb2ind(frame2im(getframe(17)),256);
imwrite(imind,cm,filename,'gif', 'Loopcount',inf);
imshow(result); drawnow;
[imind,cm] = rgb2ind(frame2im(getframe(17)),256);
imwrite(imind,cm,filename,'gif','WriteMode','append');
disp('gif saved');
댓글 수: 0
이 질문은 마감되었습니다.
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!