THIS BENCHMARK TOOL EXPECTS JUST 1 ARGUMENT: ARGV[1]: PRIMARY 2D-IMAGE PATH (COLORED OR GRAYSCALE) IT WILL BE USED IN ALL KERNELS AS INPUT IMAGE THE RESULT IMAGES WILL BE SAVED AS IMG-[PROCESSNAME].JPG """ if __name__ == "__main__": vl.vglClInit() msg = "" # INPUT IMAGE img_input = vl.VglImage(sys.argv[1], None, vl.VGL_IMAGE_2D_IMAGE(), vl.IMAGE_ND_ARRAY()) vl.vglLoadImage(img_input) vl.vglClUpload(img_input) # OUTPUT IMAGE img_output = vl.create_blank_image_as(img_input) img_output.set_oclPtr( vl.get_similar_oclPtr_object(img_input) ) vl.vglAddContext(img_output, vl.VGL_CL_CONTEXT()) # STRUCTURANT ELEMENT window = vl.VglStrEl() window.constructorFromTypeNdim(vl.VGL_STREL_CROSS(), 2) inicio = t.time() vglClNdCopy(img_input, img_output) fim = t.time() vl.vglCheckContext(img_output, vl.VGL_RAM_CONTEXT())
CL.IMAGE OBJECTS """ img_in_path = sys.argv[1] nSteps = int(sys.argv[2]) img_out_path = sys.argv[3] print("in path", img_in_path) print("steps", nSteps) print("out path", img_out_path) msg = "" vl.vglClInit() img_input_3d = vl.VglImage(img_in_path, None, vl.VGL_IMAGE_3D_IMAGE()) vl.vglLoadImage(img_input_3d) vl.vglClUpload(img_input_3d) img_output_3d = vl.create_blank_image_as(img_input_3d) img_output_3d.set_oclPtr(vl.get_similar_oclPtr_object(img_input_3d)) vl.vglAddContext(img_output_3d, vl.VGL_CL_CONTEXT()) convolution_window_3d_3x3x3 = np.ones((3, 3, 3), np.float32) * (1 / 27) convolution_window_3d_5x5x5 = np.ones((5, 5, 5), np.float32) * (1 / 125) vglCl3dBlurSq3(img_input_3d, img_output_3d) media = 0.0 for i in range(0, 5): p = 0 inicio = t.time()