GUI with GUI Live RGB-Plot of Video Data

조회 수: 3 (최근 30일)
Linda Kampe
Linda Kampe 2018년 8월 31일
댓글: Angelik Hernandez 2020년 3월 24일
Hello there, I´m creating a customized image processing software with the Image Acquisition Tool. I would like to implement a Live RGB-Plot of Preview-Data. By using the preview function, I pass the preview Data to an axes.handle, which works fine. The I like to pass the data into a customized function (to plot the RGB channels) and pass the plot to another axes-handle (I guess I have to use Event.Data, which is created by the preview function]). But it doesnt work properly. I already tried to use the UpdadepreviewWindowFunction. Does someone have any suggestions?
  댓글 수: 2
Adam
Adam 2018년 8월 31일
편집: Adam 2018년 8월 31일
Well, the problem is precisely what the error states. 'event' does not exist as a variable in that scope. You say it is created by the preview function yet you don't have any output arguments when you call preview so nothing will be passed from it into this Config_Callback function.
What does preview do exactly and what are you expecting 'event' to be such that it has a .Data field?
Linda Kampe
Linda Kampe 2018년 8월 31일
Hey Adam, thanks for your answer. In the Matlab-Documentation is is written: "When preview invokes the function handle you specify, it passes three arguments to your function: obj, himage and the event-structure (containing the fields Data, Resolution, Status, Timestamp). So you suggestion is to write it like that?: [objt, hObject, Event]=preview(handles.VidObj,handles.hImage)

댓글을 달려면 로그인하십시오.

채택된 답변

Linda Kampe
Linda Kampe 2018년 8월 31일
편집: Linda Kampe 2018년 8월 31일
In Progress...// So the Live-RGB-Histogram seems to be working. But there is still one Problem left. As you can see in the picture, the Histogram is outside of my GUI. I don´t know how to pass the axes handle to the 'setappdata(im_handle1, 'UpdatePreviewWindowFcn',@update_livehistogram_display)'. There must be a way to deliver the axes handle to my updatefunction ('update_livehistogram_display')? Any suggestions? My code is the following:
% if true
% function Config_Callback(hObject, eventdata, handles)
vid = videoinput('winvideo',1);
im_handle1 = image(zeros(1280,720));
setappdata(im_handle1, 'UpdatePreviewWindowFcn',@update_livehistogram_display);
axes(handles.Camera)
preview(vid,im_handle1);
end
function update_livehistogram_display(obj,event,hImage)
set(hImage,'CData',event.Data);
Red = event.Data(:,:,1);
Green = event.Data(:,:,2);
Blue=event.Data(:,:,3);
[yRed, x] = imhist(Red);
[yGreen, x] = imhist(Green);
[yBlue, x] = imhist(Blue);
% figure('name','value')
% axes(handles.RGB)
plot( x, yRed, 'Red', x, yGreen,'Green', x, yBlue,'Blue');
title('RGB-Live_Histogram')
ylabel('Rate')
xlabel('Intensitiy from 0 to 256')
end
% end
  댓글 수: 3
Linda Kampe
Linda Kampe 2018년 9월 2일
Hey Adam, thank you so much-that was exactly the solution I was searching for! Sorry for my delayed answer- now everything works fine :)
Angelik Hernandez
Angelik Hernandez 2020년 3월 24일
Can you help me. I did the code test and it marks me error, could you share part of your code?

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

Community Treasure Hunt

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

Start Hunting!

Translated by