How to get image in RGB
2 ビュー (過去 30 日間)
古いコメントを表示
Hi, after i convert image function cell2mat, i dont see in axes, but when i resizes image i got picture
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/158660/image.png)
in my program so question how to convert to in RGB cuz doesn work, cuz picture is double, but i think if picture is double it should be display correct. Add code bellow.
function pushbutton1_Callback(hObject, eventdata, handles)
conn = database('baze', 'root', 'root', 'Vendor', 'MYSQL', 'Server', 'localhost', 'PortNumber', 3306);
setdbprefs('datareturnformat','structure');
a = get(handles.edit8,'String');
if iscell(a) && numel(a) == 1
a = a{1};
end
if ~ischar(a) || isempty(a);
error('A valid string must be supplied!');
end
sqlquery = ['select vardas, pavarde, laipsnis, pareigos, telefonas, marke, numeris, tarnyba, nuotrauka from info '...
'where numeris = ' '''' a ''''];
curs = exec(conn, sqlquery);
setdbprefs('DataReturnFormat','cellarray');
curs = fetch(curs);
vardas = curs.data(1,1);
pavarde = curs.data(1,2);
laipsnis = curs.data(1,3);
pareigos = curs.data(1,4);
telefonas = curs.data(1,5);
marke = curs.data(1,6);
numeris = curs.data(1,7);
tarnyba = curs.data(1,8);
nuotrauka = curs.data(1,9);
set(handles.edit9,'string',vardas);
set(handles.edit2,'string',pavarde);
set(handles.edit3,'string',laipsnis);
set(handles.edit6,'string',pareigos);
set(handles.edit4,'string',telefonas);
set(handles.edit5,'string',marke);
set(handles.edit10,'string',numeris);
set(handles.edit7,'string',tarnyba);
axes(handles.axes1);
foto = cell2mat(nuotrauka);
foto1 = mat2gray(foto);
foto2 = gray2rgb(foto1);
B = imresize(foto2, [250 300]);
imshow(B);
close(curs);
close(conn);
0 件のコメント
回答 (1 件)
Salaheddin Hosseinzadeh
2016 年 12 月 5 日
Hi
I Can't find gray2rgb function in MATLAB documentation! What does that do exactly? Have a look at this link, it may help you.
Good Luck!
参考
カテゴリ
Help Center および File Exchange で Convert Image Type についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!