From: Ashish Uthama on 6 Apr 2010 14:58 On Tue, 06 Apr 2010 14:06:04 -0300, Akash <er.akash_agrawal(a)rediffmail.com> wrote: > i=imread('image.jpg') > [X,map]=rgb2ind(i,128) Here (LHS), the [] are used to indicate two distinct outputs from rgb2ind. > %after convert the image i want store the image in handles.changeimage > imshow(x,map) > function Savebutton_Callback(hObject, eventdata, handles) > % hObject handle to Savebutton (see GCBO) > % eventdata reserved - to be defined in a future version of MATLAB > % handles structure with handles and user data (see GUIDATA) > Im=handles.changeimage; > [pathname,filename] = > uiputfile({'*.jpg';'*.bmp';'*.jpg';'*.png';'*.tif';'*.gif';'*.*'},'save > as') ; > fullpath = fullfile(filename,pathname); > imwrite(Im,fullpath,'jpg'); > guidata(hObject, handles); > > ---------------error coming------------------ > ??? Error using ==> horzcat > CAT arguments dimensions are not consistent. > > Error in ==> editimage>slider1_Callback at 342 > handles.changeimage = [X,map]; Here (RHS), the [] indicate concatenation , MATLAB thinks you want to combine X and map into a single matrix and assign it to changeimage. You could either use a structure: handles.changeimage.I=X; handles.changeimage.map= map; or use two different variables in your handles structure. To preserve the map in an image file, look up the IMWRITE help and ensure that you pass the variable map to the function call in addition to the image data (Im).
|
Pages: 1 Prev: fmincon in high-dimensional optimization Next: Different runtimes for Log, Log2 and Log10 |