You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Feb 16, 2019. It is now read-only.
This example demonstrates building OpenVX graph for pixel-based skin tone detector [Peer et al. 2003]. Use [raja-koduri-640x480.jpg](http://cdn5.applesencia.com/wp-content/blogs.dir/17/files/2013/04/raja-koduri-640x480.jpg) for this example.
318
+
This example demonstrates building OpenVX graph for pixel-based skin tone detector [Peer et al. 2003]. Use [face1.jpg](https://github.com/GPUOpen-ProfessionalCompute-Libraries/amdovx-core/blob/master/examples/images/face1.jpg) for this example.
319
319
320
320
% runvx[.exe] file skintonedetect.gdf
321
321
322
322
File **skintonedetect.gdf**:
323
323
324
-
# create input and output images
325
-
data input = image:640,480,RGB2
326
-
data output = image:640,480,U008
327
-
328
-
# specify input source for input image and request for displaying input and output images
329
-
read input raja-koduri-640x480.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
0 commit comments