custom preview function using updatepreviewwindowFcN problem
2 views (last 30 days)
Show older comments
I am trying to make a custom preview function so that that i can add some sort of image processing to the input data like imadjust. There are several examples out there, but what i seem to bump into is that the data type made by image(512,640,1) is an 8 bit and probably RGB. my data is 16 bit monochrome. I dumped the data i got from "data" in mypreview2 below and it was all 8 bit. imadjust did work, but the image was strange maybe cause only one channel of the RGB got imadjust.
The basic problem is to take in 16 bit mono data and gain it up before preview gets it. thanks in advance for your help.
imaqreset; vid = videoinput('gige', 1, 'Mono16'); vid.ROIPosition = [0 0 640 512];
% Create a figure window. This example turns off the default % toolbar and menubar in the figure. hFig = figure('Toolbar','none',... 'Menubar', 'none',... 'NumberTitle','Off',... 'Name','My Custom Preview GUI');
hImage = image(zeros(512, 640, 1)); setappdata(hImage,'UpdatePreviewWindowFcn',@mypreview2_fcn);
preview(vid, hImage);
function mypreview2_fcn(obj,event,himage) data=(event.Data); data_sub=imadjust(data); set(himage,'CData',data_sub); end
1 Comment
Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!