MATLAB Answers

How to get image in RGB

1 view (last 30 days)
Gytis Raudonius
Gytis Raudonius on 5 Dec 2016
Commented: Gytis Raudonius on 5 Dec 2016
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);

Answers (1)

Salaheddin Hosseinzadeh
Salaheddin Hosseinzadeh on 5 Dec 2016
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 Comment
Gytis Raudonius
Gytis Raudonius on 5 Dec 2016
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

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!