@@ -322,55 +322,55 @@ This example demonstrates building OpenVX graph for pixel-based skin tone detect
322322File ** skintonedetect.gdf** :
323323
324324 # create input and output images
325- data input = image:480,360,RGB2
326- data output = image:480,360,U008
327-
328- # specify input source for input image and request for displaying input and output images
329- read input examples/images/face1.jpg
330- view input inputWindow
331- view output skintoneWindow
332-
333- # threshold objects
334- data thr95 = threshold:BINARY,UINT8:INIT,95 # threshold for computing R > 95
335- data thr40 = threshold:BINARY,UINT8:INIT,40 # threshold for computing G > 40
336- data thr20 = threshold:BINARY,UINT8:INIT,20 # threshold for computing B > 20
337- data thr15 = threshold:BINARY,UINT8:INIT,15 # threshold for computing R-G > 15
338- data thr0 = threshold:BINARY,UINT8:INIT,0 # threshold for computing R-B > 0
339-
340- # virtual image objects for intermediate results
341- data R = image-virtual:0,0,U008
342- data G = image-virtual:0,0,U008
343- data B = image-virtual:0,0,U008
344- data RmG = image-virtual:0,0,U008
345- data RmB = image-virtual:0,0,U008
346- data R95 = image-virtual:0,0,U008
347- data G40 = image-virtual:0,0,U008
348- data B20 = image-virtual:0,0,U008
349- data RmG15 = image-virtual:0,0,U008
350- data RmB0 = image-virtual:0,0,U008
351- data and1 = image-virtual:0,0,U008
352- data and2 = image-virtual:0,0,U008
353- data and3 = image-virtual:0,0,U008
354-
355- # extract R,G,B channels and compute R-G and R-B
356- node org.khronos.openvx.channel_extract input !CHANNEL_R R # extract R channel
357- node org.khronos.openvx.channel_extract input !CHANNEL_G G # extract G channel
358- node org.khronos.openvx.channel_extract input !CHANNEL_B B # extract B channel
359- node org.khronos.openvx.subtract R G !SATURATE RmG # compute R-G
360- node org.khronos.openvx.subtract R B !SATURATE RmB # compute R-B
361-
362- # compute threshold
363- node org.khronos.openvx.threshold R thr95 R95 # compute R > 95
364- node org.khronos.openvx.threshold G thr40 G40 # compute G > 40
365- node org.khronos.openvx.threshold B thr20 B20 # compute B > 20
366- node org.khronos.openvx.threshold RmG thr15 RmG15 # compute RmG > 15
367- node org.khronos.openvx.threshold RmB thr0 RmB0 # compute RmB > 0
368-
369- # aggregate all thresholded values to produce SKIN pixels
370- node org.khronos.openvx.and R95 G40 and1 # compute R95 & G40
371- node org.khronos.openvx.and and1 B20 and2 # compute B20 & and1
372- node org.khronos.openvx.and RmG15 RmB0 and3 # compute RmG15 & RmB0
373- node org.khronos.openvx.and and2 and3 output # compute and2 & and3 as output
325+ data input = image:480,360,RGB2
326+ data output = image:480,360,U008
327+
328+ # specify input source for input image and request for displaying input and output images
329+ read input examples/images/face1.jpg
330+ view input inputWindow
331+ view output skintoneWindow
332+
333+ # threshold objects
334+ data thr95 = threshold:BINARY,UINT8:INIT,95 # threshold for computing R > 95
335+ data thr40 = threshold:BINARY,UINT8:INIT,40 # threshold for computing G > 40
336+ data thr20 = threshold:BINARY,UINT8:INIT,20 # threshold for computing B > 20
337+ data thr15 = threshold:BINARY,UINT8:INIT,15 # threshold for computing R-G > 15
338+ data thr0 = threshold:BINARY,UINT8:INIT,0 # threshold for computing R-B > 0
339+
340+ # virtual image objects for intermediate results
341+ data R = image-virtual:0,0,U008
342+ data G = image-virtual:0,0,U008
343+ data B = image-virtual:0,0,U008
344+ data RmG = image-virtual:0,0,U008
345+ data RmB = image-virtual:0,0,U008
346+ data R95 = image-virtual:0,0,U008
347+ data G40 = image-virtual:0,0,U008
348+ data B20 = image-virtual:0,0,U008
349+ data RmG15 = image-virtual:0,0,U008
350+ data RmB0 = image-virtual:0,0,U008
351+ data and1 = image-virtual:0,0,U008
352+ data and2 = image-virtual:0,0,U008
353+ data and3 = image-virtual:0,0,U008
354+
355+ # extract R,G,B channels and compute R-G and R-B
356+ node org.khronos.openvx.channel_extract input !CHANNEL_R R # extract R channel
357+ node org.khronos.openvx.channel_extract input !CHANNEL_G G # extract G channel
358+ node org.khronos.openvx.channel_extract input !CHANNEL_B B # extract B channel
359+ node org.khronos.openvx.subtract R G !SATURATE RmG # compute R-G
360+ node org.khronos.openvx.subtract R B !SATURATE RmB # compute R-B
361+
362+ # compute threshold
363+ node org.khronos.openvx.threshold R thr95 R95 # compute R > 95
364+ node org.khronos.openvx.threshold G thr40 G40 # compute G > 40
365+ node org.khronos.openvx.threshold B thr20 B20 # compute B > 20
366+ node org.khronos.openvx.threshold RmG thr15 RmG15 # compute RmG > 15
367+ node org.khronos.openvx.threshold RmB thr0 RmB0 # compute RmB > 0
368+
369+ # aggregate all thresholded values to produce SKIN pixels
370+ node org.khronos.openvx.and R95 G40 and1 # compute R95 & G40
371+ node org.khronos.openvx.and and1 B20 and2 # compute B20 & and1
372+ node org.khronos.openvx.and RmG15 RmB0 and3 # compute RmG15 & RmB0
373+ node org.khronos.openvx.and and2 and3 output # compute and2 & and3 as output
374374
375375
376376### Feature Tracker
0 commit comments