How to get image in RGB

3 次查看(过去 30 天)
Gytis Raudonius
Gytis Raudonius 2016-12-5
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);

回答(1 个)

Salaheddin Hosseinzadeh
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!
  1 个评论
Gytis Raudonius
Gytis Raudonius 2016-12-5
try this not work, cuz my picture is not clear at grey i think is somethink corrupted.
as you see in picture its like noise

请先登录,再进行评论。

Community Treasure Hunt

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

Start Hunting!

Translated by