c2 cautruc anh

Upload: hotrivien

Post on 11-Oct-2015

31 views

Category:

Documents


0 download

TRANSCRIPT

  • CU TRC NHTS Nguyn c Thnh*

    TS Nguyn c Thnh

  • BIU DIN NH Snh gm tp hp cc im nhnh 2D l hm f(x,y); x, y l ta im nh, f l cng sng im ; vi nh n sc, f gi l mc xmnh mu l t hp cc nh 2Dnh RGB l t hp ba nh thnh phn , l cy, xanhVi nh s cc i lng x, y, f l ri rcTS Nguyn c Thnh*

    TS Nguyn c Thnh

  • BIU DIN NH Snh s biu th bng ma trn M hng N ct, mi phn t trong ma trn gi l im nh (picture element, , pel), c gi tr l cng sng nh, l s nguyn L=2K, K l s bitnh M, N ,K c dung lng l M*N*K phn gii nh (spatial resolution) l tch s M*N, nh c phn gii ln th kch thc im nh nhnh nh phn c K = 1, cng sng ti mi im nh c mt trong hai gi tr.nh n sc c K > 1, thng l 8nh mu gm ba mu c bn phi hp, mi mu c bn biu din sng bng K >1nh s c lu trong my tnh di nhiu nh dngnh xm biu th bng ma trn M*N, nh mu biu th bng ba hay bn ma trn M*Nnh s c x l theo cc php tnh ma trn TS Nguyn c Thnh*

    TS Nguyn c Thnh

  • BIU DIN NH STS Nguyn c Thnh*nh c biu din bi cc pixel.

    TS Nguyn c Thnh

  • BIU DIN NH STS Nguyn c Thnh*nh lin tc i sang nh s 12*14 pixel

    TS Nguyn c Thnh

  • BIU DIN NH STS Nguyn c Thnh*

    TS Nguyn c Thnh

  • BIU DIN NH Snh kch thc ln c th a v nh kch thc nh hn bng cch b mt s hng v ct, gi l subsampling, sau t chng st nhau, gi s mi pixel biu th trn giy hay mn hnh c kch thc c nh th nh subsampling s c kch thc nh hnnh kch thc nh khi zoom ln s b hin tng bn c (checkerboard) TS Nguyn c Thnh*

    TS Nguyn c Thnh

  • CO NH (SHRINKING, SUBSAMPLING, UNDERSAMPLING)TS Nguyn c Thnh*

    TS Nguyn c Thnh

  • ZOOM NHTS Nguyn c Thnh*

    TS Nguyn c Thnh

  • CNG XMCng sng ti mi pixel c ly mu bng k bit, gi l phn gii mc xm, nu k nh s b hin tng mt ng bin (false contouring)i vi th gic my tnh nh s c kch thc 256*256*8 l ph hpnh nh phn c k = 1, mc en gi tr 0, mc trng gi tr 1Thng thng k=8, c 256 mc xm, 0 l mc en, 255 l mc trng

    TS Nguyn c Thnh*

    TS Nguyn c Thnh

  • CNG SNGTS Nguyn c Thnh*Mc xm thay i t 16 (k=4) n k=1

    TS Nguyn c Thnh

  • NI SUY NH trnh hin tng bn c khi zoom nh cn phi thm cc im nh mi v gn cng sng cho cc im nh ny

    TS Nguyn c Thnh*

    TS Nguyn c Thnh

  • C NHnh s c lu li trong my tnh vi nhiu nh dng

    TS Nguyn c Thnh*Trong Matlab dng lnh imread(filename, format) c nh vo mt bina=imread('e:\baigiang\computer vision\SDC16361.JPG');size(a);% kich thc nhwhos a; % thng s nhimshow(a,[ ]); %hin th nh

    TS Nguyn c Thnh

  • TS Nguyn c Thnh*

    TS Nguyn c Thnh

  • I MA TRN RA NH XM, LU NHI = mat2gray(A, [amin amax]) I = mat2gray(A)A l ma trn, amin amax l gi tr ca phn t tng ng en (0.0) v trng (1.0), I l nh xm, nu khng c thng s amin amax th ly gi tr trong ATS Nguyn c Thnh*>> ss = 1 2 3 4 5 6 7 8 9>> i=mat2gray(s,[1 10])i = 0 0.1111 0.2222 0.3333 0.4444 0.5556 0.6667 0.7778 0.8889>> imshow(i)>> imwrite(i,'a.jpg','jpg')>> imshow('a.jpg')

    TS Nguyn c Thnh

  • MT S HM MA TRN Gam kch thc nha=imread(SDC1361.JPG);b=a(1:10:end,1:10:end,:);imshow(b)Lt nh theo chiu dcb=b(end:-1:1,:,: );imshow(b)TS Nguyn c Thnh*

    TS Nguyn c Thnh

  • CT NH% This program crops a rectangular portion of a given image% Submitted By : Chiranjit Bordoloi & Hemashree Bordoloi% Get Image clc; close all; clear all; %clean board a = imread('e:\baigiang\computer vision\SDC16361.JPG'); %read image [m n]= size(a); %get no of rows and column of the image matrix imshow(a) %display original image % Crop Image Using Submatrix Operation [y,x] = ginput(2); %select two cursor points r1 = x(1,1); c1 = y(1,1); %get first cursor point = first corner of the rectangle r2 = x(2,1); c2 = y(2,1); %get second cursor point = second corner of the rectangle b = a(r1:r2,c1:c2,:); figure;; %create the sub-matriximshow(b) %display croped image

    TS Nguyn c Thnh*

    TS Nguyn c Thnh

  • CT NHDng hm m:function s=subim1(f,m,n,rx,cy)rowhigh=rx+m-1;colhigh=cy+n-1;s=f(rx:rowhigh,cy:colhigh,:);

    a=imread('e:\baigiang\computer vision\SDC16361.JPG');s= subim1(a,200,500,100,100);figure;Imshow(s);

    TS Nguyn c Thnh*

    TS Nguyn c Thnh

  • MATLABMatlab 2013 c cc toolbox x l nh v th gic my tnh:Image Acquisition ToolboxImage Processing ToolboxComputer vision ToolBoxTi liu v MatlabDigital image Processing 3rd E. Gonzales Woods Digital image Processing using Matlab Gonzales TS Nguyn c Thnh*

    TS Nguyn c Thnh

  • TS Nguyn c Thnh*

    TS Nguyn c Thnh

  • TS Nguyn c Thnh*

    TS Nguyn c Thnh

  • TS Nguyn c Thnh*

    TS Nguyn c Thnh

  • NH DNG NH (Image Format)nh c lu tr trn my tnh vi nhiu nh dngC nhiu nh dng nhnh thng c nn gim kch thc filenh nh dng theo kiu qut (raster) hay vectornh raster biu din di dng ma trn cc im nhnh vector lu tr s quan h gia cc im nhBMP (Windows bit map) nh dng lu nh khng nn, tn nhiu b nh, c h tr bi nhiu phn mm chy trn windows, h tr nh mu n 32 bit, bng mu BGRCu trc tp tin nh BMP bao gm 4 phnBitmap Header (14 bytes): gip nhn dng tp tin bitmap.Bitmap Information Header (s byte thay i): lu mt s thng tin chi tit gip hin th nh.Color Palette (4*x bytes), x l s mu ca nh: nh ngha cc mu s c s dng trong nh.Bitmap Data: lu d liu nh t tri sang phi, t di ln trn, mi hng nh c b sung sao cho s byte mi hng l bi s ca 4

    TS Nguyn c Thnh*

    TS Nguyn c Thnh

  • NH BMPTS Nguyn c Thnh*http://en.wikipedia.org/wiki/BMP_file_format

    TS Nguyn c Thnh

  • NH DNG NH (Image Format)JPEG (http://en.wikipedia.org/wiki/JPEG) nh dng nh nn c mt mt (lossy) hay khng mt mt (lossless) do nhm Joint Photographic Expert Group hon thin, gip lm gim kch thc nh GIF (Graphic Interchange Format) dng biu din nh ng trn trang web, nh nn khng mt mt c kch thc nh v 256 mu.PNG (Portable Network Graphic) tng t GIF, c th biu din 24 bit muTIFF (Tagged image File Format) nh dng nh mm do, bao gm nh nn v khng nnTS Nguyn c Thnh*

    TS Nguyn c Thnh

  • NH MUTS Nguyn c Thnh*Mu sc l kt hp cc mu c bn ph thuc c ch nhn mu ca mtM hnh RGB dng cc mu c bn l Red (), Green (L cy, Lc) , Blue (Xanh) thng dng cho TVM hnh CMY dng cc mu c bn l Cyan (lc lam, xanh c ban, xanh ngc ) , Magenta ( ti, cnh sen ) Yellow (Vng) thng dng cho my in muM hnh CMYK dng thm mu en K

    TS Nguyn c Thnh

  • M HNH RGBTS Nguyn c Thnh*Cc mu c bn khng nh ngha chnh xc, do cc mn hnh khc nhau cho cc nh mu khc nhauM hnh RGB biu din mu nh mt im trong hnh hp n v RGB, mu en c ta (0 0 0) v mu trng l (1 1 1)Nu dng 8 bit biu din mt mu c bn th mu en l (0 0 0) v mu trng l (255 255 255), Cyan l hn hp G+B, Magenta: R+B, Yellow: R+GMu RGB 24 bit (true color) dng 8 bit cho mi mu c bn, tng cng khong 16,7 triu muRGBA dng 32 bit, 8 bit thm vo l knh alpha, biu th trong sut, 0 l hon ton trong sut, 255 l c, gip to cc nh chng ln nhau

    TS Nguyn c Thnh

  • M HNH RGBNu a l nh th cc lnh sau c cc ma trn mu c bn RGBar = a(:,:,1);ag= a(:,:,2);ab= a(:,:,3);Cc nh thnh phn l cc nh xm biu th cng mi mu c bnNgc li, lnh sau to nh mu t cc mu c bna = cat(3,ar,ag,ab);Hm rgb2gray i nh mu ra nh xm theo thut ton 0.2989 * R + 0.5870 * G + 0.1140 * B

    TS Nguyn c Thnh*

    TS Nguyn c Thnh

  • TS Nguyn c Thnh*Ba thnh phn mu ca mt hnh c mu nh xm

    TS Nguyn c Thnh

  • TS Nguyn c Thnh*

    TS Nguyn c Thnh

  • im=imread('c:\anna_chapman.jpg');figure, imshow(im);TS Nguyn c Thnh*

    TS Nguyn c Thnh

  • LP TRNH DNG VB6Private Declare Function GetPixel Lib "gdi32" (ByVal hdc As Long,ByVal x As Long, ByVal y As Long) As LongPrivate Declare Function SetPixelV Lib "gdi32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal color As Long) As LongPrivate Sub Command1_Click()Dim color As LongDim hdc1 As LongDim hdc2 As LongDim picw As LongDim pich As LongDim y As LongDim x As Longhdc1 = Picture1.hdcTS Nguyn c Thnh*

    TS Nguyn c Thnh

  • LP TRNH DNG VB6hdc2 = Picture2.hdcpicw = Picture1.Widthpich = Picture1.HeightFor y = 0 To pich - 1 For x = 0 To picw - 1 color = GetPixel(hdc1, x, y) color = 0.33 * (color Mod 256) + 0.59 * ((color \ 256) Mod 256) + 0.11 * ((color \ 65536) Mod 256) SetPixelV Picture2.hdc, x, y, RGB(color, color, color) Next Next Picture2.RefreshEnd Sub

    TS Nguyn c Thnh*

    TS Nguyn c Thnh

  • LP TRNH DNG VB6Private Sub Command2_Click()EndEnd SubPrivate Sub Form_Load()Picture1.Picture = LoadPicture("c:\anna_chapman.jpg")End Sub

    TS Nguyn c Thnh*

    TS Nguyn c Thnh

  • LP TRNH DNG VB6TS Nguyn c Thnh*

    TS Nguyn c Thnh

  • LP TRNH DNG VB.NETPublic Class Form1 Private Sub COLOR2GRAY_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles COLOR2GRAY.Click Nu c nh lc run : PictureBox1.Image=image.fromfile(ng dn)Dim bm As New Bitmap(PictureBox1.Image) Dim X As Integer Dim Y As Integer Dim clr As Integer For X = 0 To bm.Width - 1 For Y = 0 To bm.Height - 1

    TS Nguyn c Thnh*

    TS Nguyn c Thnh

  • LP TRNH DNG VB.NET clr = (CInt(bm.GetPixel(X, Y).R) + _ bm.GetPixel(X, Y).G + _ bm.GetPixel(X, Y).B) \ 3 bm.SetPixel(X, Y, Color.FromArgb(clr, clr, clr)) Next Y Next X PictureBox1.Image = bm End SubEnd ClassTS Nguyn c Thnh*

    TS Nguyn c Thnh

  • LP TRNH DNG VB.NETTS Nguyn c Thnh*

    TS Nguyn c Thnh

  • LP TRNH DNG C#private void Form1_Load(object sender, EventArgs e) { pictureBox1.Image = Image.FromFile("C:/anna_chapman.jpg"); } private void button1_Click(object sender, EventArgs e) { Bitmap bm = new Bitmap(pictureBox1.Image); for (int y = 0; y < bm.Height; y++) { for (int x = 0; x < bm.Width; x++) { Color c = bm.GetPixel(x, y);

    TS Nguyn c Thnh*

    TS Nguyn c Thnh

  • LP TRNH DNG C# int luma = (int)(c.R * 0.3 + c.G * 0.59 + c.B * 0.11); bm.SetPixel(x, y, Color.FromArgb(luma, luma, luma)); } } pictureBox1.Image = bm; } TS Nguyn c Thnh*

    TS Nguyn c Thnh

  • H MU CMYKH mu CMYK s dng trong in mu, sn mu, gm ba mu c bn l Cyan (xanh ngc), Magenta (hng cnh sen) , Yellow (vng) v K (en)Ba mu CMY kt hp to ra mu en, cn trong in n, cn ba mu RGB to ra mu trng, cn cho mn hnh, h m u RGB gi l h mu cng cn h mu CMY gi l h mu tr Hm imcomplement trong Matlab chuyn i gia hai h

    TS Nguyn c Thnh*C=1-RM=1-GY=1-B

    TS Nguyn c Thnh

  • H MU CMYKChuyn i gia CMY v CMYK theo cng thc K= min (C,M,Y)C=C-KM=M-KY=Y-KTS Nguyn c Thnh*

    TS Nguyn c Thnh

  • KHNG GIAN MU HSVKhng gian mu H (Hue, mu sc), S (Saturation, bo ha), V (Value) khng dng cc mu c bn, gn ging cm nhn con ngi v mu, thng dng trong ha my tnhKhng gian mu HSV c ta tr, pht xut t khng gian RGB vi gc l im en, trc hnh tr l ng ni im en v trng, im en ni cc mu c bn to hnh nn, Hue tng ng vi bc sng ca nh sng, biu th theo gc t 00 n 3600 pht xut t im R; S biu th tinh khit ca mu, v d Red c S l 100% cn mu hng c S km hn v pha trn thm mu trng, V biu th sng ti, tnh theo trc hnh nn, en c V=0 cn trng c V=1TS Nguyn c Thnh*

    TS Nguyn c Thnh

  • KHNG GIAN MU HSVTS Nguyn c Thnh*Matlab dng hm rgb2hsv v hsv2rgb chuyn i qua li gia hai h mu

    TS Nguyn c Thnh

  • CHUYN I RGB HSVMAX= MAX(R,G,B)MIN=MIN(R,G,B)C=MAX-MINNu MAX=MIN(R,G,B) l nh xm, H=0, S=0S=C/MAXV=MAXIf (R == MAX) { H = (G - B) / C; if(H < 0.0) { H += 6.0; } }

    TS Nguyn c Thnh*else if(G == Max) { H = ((B - R) / C) + 2.0; } else //B == Max {H = ((R - G) / C) + 4.0; } H *= 60.0;

    TS Nguyn c Thnh

  • KHNG GIAN MU HSVRGB=reshape(ones(64,1)*reshape(jet(64),1,192),[64,64,3]);HSV=rgb2hsv(RGB); H=HSV(:,:,1); S=HSV(:,:,2); V=HSV(:,:,3); subplot(2,2,1), imshow(H) subplot(2,2,2), imshow(S) subplot(2,2,3), imshow(V) subplot(2,2,4), imshow(RGB)TS Nguyn c Thnh*

    TS Nguyn c Thnh

  • CHUYN I RGB HSVTS Nguyn c Thnh*

    TS Nguyn c Thnh

  • CHUYN I RGB HSVTS Nguyn c Thnh*

    TS Nguyn c Thnh

  • KHNG GIAN MU HSIKhng gian mu HSI tng t HSV trong gi tr I l cng sngKhng gian mu HIS gip cho vic x l nh d dng hn, tng t cch con ngi nhn, khng cn bit thnh phn mu c bnTS Nguyn c Thnh*

    TS Nguyn c Thnh

  • KHNG GIAN MU HSIChuyn i RGB HSI

    TS Nguyn c Thnh*Nu B>G, H=3600 -HChuyn i HIS RGB: ty thuc gc H

    TS Nguyn c Thnh

  • KHNG GIAN MU HSIon RG (00
  • KHNG GIAN MU HSIHm RGB2HSI, HSI2RGB chuyn i gia RGB v HSI

    TS Nguyn c Thnh*function hsi= rgb2hsi(rgb)rgb=im2double(rgb);r=rgb(:,:,1);g=rgb(:,:,2);b=rgb(:,:,3);num = 0.5*((r-b)+r-g);den=sqrt((r-g).^2+(r-b).*(g-b));theta=acos(num./(den+eps));H=theta;

    H(b>g)=2*pi-H(b>g);H=H/2*pi;num = min(min(r,g),b);den = r+g+b;den(den==0) = eps;S=1-3.*num./den;H(S==0) = 0;I = (r+g+b)/3;hsi = cat(3,H,S,I);

    TS Nguyn c Thnh

  • KHNG GIAN MU HSITS Nguyn c Thnh*

    TS Nguyn c Thnh

  • KHNG GIAN MU HSITS Nguyn c Thnh*

    TS Nguyn c Thnh

  • CC HM CHUYN I KHNG GIAN MUrgb2gray: i nh mu rgb sang nh xmIm2bw(src,level): i nh mu hay xm ra nh nh phn, level l mc ngng, nu khng c tham s level th mc ngng l 0.5. Ngng c tnh bng hm graythresh

    TS Nguyn c Thnh*

    TS Nguyn c Thnh

  • CC HM CHUYN I KHNG GIAN MUTS Nguyn c Thnh*

    TS Nguyn c Thnh

  • X L FILE VIDEO DNG MATLABc file video vo bin obj: obj=mmreader(filename); file c ui avi, mpg,mp4,wmvObj c cc thuc tnh:

    TS Nguyn c Thnh*

    TS Nguyn c Thnh

  • X L FILE VIDEO DNG MATLABHm implay(filename, framespersec) trnh din videoHm video = read(obj, index) c frame index vo mt nh x lvid=mmreader('traffic.avi');n=vid.numberofframes;for k=1:n vid1=read(vid,k); vid2(:,:,k)=rgb2gray(vid1);endimplay(vid2)

    TS Nguyn c Thnh*

    TS Nguyn c Thnh

  • GIAO TIP CAMERA DNG MATLABMatlab nhn nh camera ni vi cng USB hay card bt nh frame grabber gi chung l adaptorDng hm imaqhwinfo tm thng tin v adaptor imaqhwinfoans = InstalledAdaptors: {'coreco' 'winvideo'} MATLABVersion: '7.9 (R2009b)' ToolboxName: 'Image Acquisition Toolbox' ToolboxVersion: '3.4 (R2009b)Tm ID ca camera: imaqhwinfo(adaptorname)Tm format ca file video: imaqhwinfo(adaptorname, deviceid)Nhn nh video vo bin: obj = videoinput(adaptorname,deviceID,format)TS Nguyn c Thnh*

    TS Nguyn c Thnh

  • >> hwInfo = imaqhwinfo('winvideo')hwInfo = AdaptorDllName: [1x67 char] AdaptorDllVersion: '4.5 (R2013a)' AdaptorName: 'winvideo' DeviceIDs: {[1] [2] [3]} DeviceInfo: [1x3 struct]>> device1 = hwInfo.DeviceInfo(2)device1 = DefaultFormat: 'YUY2_1280x1024' DeviceFileSupported: 0 DeviceName: 'USB 2.0 UVC 1.3M WebCam' DeviceID: 2 VideoInputConstructor: 'videoinput('winvideo', 2)' VideoDeviceConstructor: 'imaq.VideoDevice('winvideo', 2)' SupportedFormats: {1x6 cell}TS Nguyn c Thnh*

    TS Nguyn c Thnh

  • 'device1.SupportedFormatsans = Columns 1 through 4 'YUY2_1280x1024' 'YUY2_160x120' 'YUY2_176x144' 'YUY2_320x240 Columns 5 through 6 'YUY2_352x288' 'YUY2_640x480

    TS Nguyn c Thnh*

    TS Nguyn c Thnh

  • GIAO TIP CAMERA DNG MATLABXem trc: preview(obj)ng ca s: close(obj)Xa : delete(obj)c mt frame x l: data=getsnapshot(obj)Hin th frame: imshow(data) hay image(data), imagesc(data)vid=videoinput('winvideo',1,YUY2_1280X1024'); hay vid=videoinput('winvideo',1); hay vid= imaq.VideoDevice('winvideo', 2);set(vid,'ReturnedColorSpace','rgb');preview(vid);frame = getsnapshot(vid);image(frame);delete(vid);TS Nguyn c Thnh*

    TS Nguyn c Thnh

  • GIAO TIP CAMERA DNG MATLABMun lu d liu video vo b nh dng lnh start(obj), ch l b nh c th b trn sau mt thi gianNgng nhn video: stop(obj)c n frame trong buffer: data =get(obj,n)obj c nhiu thuc tnh, dng lnh imaqhelp videoinput tm hiuTS Nguyn c Thnh*

    TS Nguyn c Thnh

  • GIAO TIP CAMERA DNG MATLAB videoinput - Construct a video input object. Configuration. get - Get value of image acquisition object property. inspect - Open property inspector and configure image acquisition object properties. set - Set value of image acquisition object property. Execution. getselectedsource - Return the video source object currently selected for acquisition. start - Initiate video input object to start running. stop - Stop object running and logging. Release Gai phng wait - Wait for video input object to stop running. Trigger Functions. trigger - Manually initiate logging for running object. triggerconfig - Configure video input object to a trigger configuration. triggerinfo - Return all valid trigger configurations.

    TS Nguyn c Thnh*

    TS Nguyn c Thnh

  • GIAO TIP CAMERA DNG MATLABData Functions. flushdata - Remove buffered image frames from memory. getdata - Return acquired image frames from buffer. getsnapshot - Immediately acquire a single image frame. peekdata - Return most recently acquired image frames. Tools. closepreview - Close image preview windows. imaqmem - Limit or display memory used for acquiring frames. imaqmontage - Display acquired image frames as a montage. preview - Activate a live image preview window. General. delete - Remove video input object from memory. imaqcallback - Display event information for an acquisition event. imaqfind - Find image acquisition objects with specified property values. imaqreset - Delete and unload all image acquisition objects and adaptors. isvalid - True for image acquisition objects that can be associated with hardware.

    TS Nguyn c Thnh*

    TS Nguyn c Thnh

  • GIAO TIP CAMERA DNG MATLABVIDEOINPUT Properties. DeviceID - Hardware device identifier. DiskLogger - Specify the MATLAB AVIFILE object used to log data. ErrorFcn - Callback function to execute when a runtime error occurs. EventLog - Information relating to specific events. FrameGrabInterval - Specify the frame buffering interval. FramesAvailable - Number of buffered frames available per source. FramesAcquired - Total number of frames acquired per source. FramesAcquiredFcn - Callback to execute every time a predefined number of frames is acquired. FramesAcquiredFcnCount - Number of frames to acquire before a frames acquired event is generated. FramesPerTrigger - Number of frames to acquire for each trigger. Logging - Indicate whether data is being logged or not. TS Nguyn c Thnh*

    TS Nguyn c Thnh

  • GIAO TIP CAMERA DNG MATLABLoggingMode - Specify the destination for acquired image data.Name - Descriptive name of the video input object.ROIPosition - Specify the region of interest acquisition window.Running - Indicates if the video input object is in an acquisition state.SelectedSourceName - Currently selected video source to be used for acquisition.Source - Video source objects contained by a video input object.StartFcn - Callback function to execute just before the video input object and hardware device start executing. TS Nguyn c Thnh*

    TS Nguyn c Thnh

  • GIAO TIP CAMERA DNG MATLABStopFcn - Callback function to execute just after the video input object and hardware device stop executing.Tag - Label for object.Timeout - Waiting time to extract image data. TimerFcn - Callback function to execute whenever a predefined period of time passes. TS Nguyn c Thnh*

    TS Nguyn c Thnh

  • GIAO TIP CAMERA DNG MATLABTimerPeriod - Period of time between timer events. TriggerCondition - Condition on which a trigger is issued. TriggerFcn - Callback function to execute when a trigger occurs. TriggerFrameDelay - Delay value for logging image frames. TriggerRepeat - Number of additional times to repeat a trigger. TriggersExecuted - Number of triggers executed.TS Nguyn c Thnh*

    TS Nguyn c Thnh

  • GIAO TIP CAMERA DNG MATLAB TriggerSource - Trigger source that initiates the acquisition. TriggerType - Type of trigger to issue. Type - Object type. UserData - User data for object. VideoFormat - Video input format from the hardware. VideoResolution - Vector indicating the image width and height for the incoming video signal.

    TS Nguyn c Thnh*

    TS Nguyn c Thnh

  • CAM READclc;v = videoinput('winvideo', 2,'YUY2_640X480');%v.FramesPerTrigger = 1;preview(v);start(v);wait(v,Inf);set(v,'ReturnedColorSpace','rgb');l=1;for l=1:20rgbImage = getsnapshot(v); image(rgbImage);pause(1);endstop(v);delete(v);

    TS Nguyn c Thnh*

    TS Nguyn c Thnh

  • skin_detectskin_detect.mfunction [out bin] = generate_skinmap(filename) if nargin > 1 | nargin < 1 error('usage: generate_skinmap(filename)'); end; img_orig = imread(filename); height = size(img_orig,1); width = size(img_orig,2); out = img_orig; bin = zeros(height,width); img = grayworld(img_orig); img_ycbcr = rgb2ycbcr(img); TS Nguyn c Thnh*

    TS Nguyn c Thnh

  • Cb = img_ycbcr(:,:,2); Cr = img_ycbcr(:,:,3); [r,c,v] = find(Cb>=77 & Cb=133 & Cr
  • GIAO TIP CAMERA DNG VB, VCDng th vin avicap32.dll ca windowsDng directxDng OpenCVTh d dng avicap32.dll, vb.netc thng s camera vo chui strNamebReturn = capGetDriverDescriptionA(x, strName, 100, strVer, 100)To ca s xem videoDim data As IDataObject Dim bmap As ImagehHwnd = capCreateCaptureWindowA(iDevice, WS_VISIBLE Or WS_CHILD, 0, 0, 320, 240, picCapture.Handle.ToInt32, 0)If SendMessage(hHwnd, WM_CAP_DRIVER_CONNECT, iDevice, 0) Then'Set the preview scale SendMessage(hHwnd, WM_CAP_SET_SCALE, True, 0)

    TS Nguyn c Thnh*

    TS Nguyn c Thnh

  • 'Set the preview rate in 30 milliseconds ' SendMessage(hHwnd, WM_CAP_SET_PREVIEWRATE, 30, 0)If data.GetDataPresent(GetType(System.Drawing.Bitmap)) Then bmap = CType(data.GetData(GetType(System.Drawing.Bitmap)), Image) picCapture.Image = bmapEnd if 'Start previewing the image from the camera ' SendMessage(hHwnd, WM_CAP_SET_PREVIEW, True, 0)' Resize window to fit in picturebox ' SetWindowPos(hHwnd, HWND_BOTTOM, 0, 0, picCapture.Width, picCapture.Height, SWP_NOMOVE Or SWP_NOZORDER) TS Nguyn c Thnh*

    TS Nguyn c Thnh

  • Get frame SendMessage(hHwnd, WM_CAP_EDIT_COPY, 0, 0) ' Get image from clipboard and convert it to a bitmap data = Clipboard.GetDataObject()

    DisconnectSendMessage(hHwnd, WM_CAP_DRIVER_DISCONNECT, iDevice, 0)' close preview window DestroyWindow(hHwnd)TS Nguyn c Thnh*

    TS Nguyn c Thnh

  • QUAN H GIA CC PIXELLn cn (neighbor): pixel p(x,y) c bn cn 4 k hiu N4(p) ta (x+1,y), (x-1,y), (x,y+1), (x,y-1)Bn cn cho k hiu ND(p): (x+1, y+1), (x+1, y-1), (x-1, y+1), (x-1, y-1)Tm cn 8 N8(p) bao gm bn cn 4 v bn cn cho

    TS Nguyn c Thnh*

    TS Nguyn c Thnh

    *