How to get image in RGB
3 次查看(过去 30 天)
显示 更早的评论
Hi, after i convert image function cell2mat, i dont see in axes, but when i resizes image i got picture
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 中查找有关 Basic Display 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!