演示代码:
- Width:=10
- Height:=10
- tuple_rand (Width*Height, Rand)
- RandNum:=Rand*100
- tuple_is_int(RandNum, IsInt)
- if(IsInt = 0)
- tuple_int(RandNum, RandNum)
- tuple_add (RandNum, 100, RandNum)
- endif
- gen_image_by_grayval (Image, Width, Height, RandNum)
复制代码- GrayVal:=[]
- for Index:=0 to 255 by 1
- GrayVal:=[GrayVal,Index]
- endfor
- gen_image_by_grayval (Image, 16, 16, GrayVal)
复制代码
效果图:
外部封装的算子gen_image_by_grayval
签名:
gen_image_by_grayval( : Image : Width, Height, GrayArray : )
参数:
Image (output_object) image → object (byte) 输出产生的图像
Width (input_control) integer → (integer) 输入图片的宽度信息
Height (input_control) integer → (integer) 输入图片的高度信息
GrayArray (input_control) integer → (integer) 输入图片宽高对应大小的灰度信息
函数内容:
懒人直接下载文件:
效率方面,毕竟里面用了for循环,可能慢了许多,有更好方案的可以联系我进行修改!
其他类似生成的算子:
- gen_image_surface_first_order
- gen_image_gray_ramp
复制代码
|