[im-users] How to create image using my own data
Antonio Scuri
scuri at tecgraf.puc-rio.br
Mon Mar 28 10:48:28 BRT 2005
I'm sorry but your message got stuck in LuaForge message system and only
arrived during this weekend. The LuaForge guys just fixed a bug and flush
held messages.
Yes, you can use imImageInit to do that. But this functions was made to
allocate an imImage structure for already allocated image memory.
If you need also to allocate the memory, then you could simply use
imImageCreate.
A Kernel is simply another image with some special characteristics. To
create a kernel, you simply create an image and set its pixel values.
There are some predefined functions that can convolve the image with
gaussian and sobel kernels. But you can create a gaussian kernel by simply
calling imProcessRenderGaussian. A sobel kernel can be created using:
imImage* kernel = imImageCreate(3, 3, IM_GRAY, IM_INT);
imImageSetAttribute(kernel, "Description", IM_BYTE, -1, (void*)"SobelY");
int* kernel_data = (int*)kernel->data[0];
kernel_data[0] = 1;
kernel_data[1] = 2;
kernel_data[2] = 1;
kernel_data[3] = 0;
kernel_data[4] = 0;
kernel_data[5] = 0;
kernel_data[6] = -1;
kernel_data[7] = -2;
kernel_data[8] = -1;
Just for curiosity, if you have MATLAB why to use IM? MATLAB should have
already everything you need for image processing with the additional toolkit.
Best,
scuri
At 12:57 2/2/2005, yip tommy wrote:
>I have my own data (that is exported from MATLAB), I
>want to create an image to have process to this image,
>such as convolution. Can I use imImageInit() function
>to do that? May anyone teach me how to allocate my own
>data to do image operation?
>
>Also, I know that IM can do convolution, but it
>requires a kernal. How to create the kernal? For
>example, I want to have Gaussian and Sobel kernal.
>
>Thanks very much.
>
>Tommy
>
>_________________________________________________________
>¥²±þ§Þ¡B¶¼ºq¡B¤p¬P¬P...
>®öº©¹aÁn ±¡¤ß³sô
>http://us.rd.yahoo.com/evt=22281/*http://ringtone.yahoo.com.hk/
>
>_______________________________________________
>imtoolkit-users mailing list
>imtoolkit-users at lists.luaforge.net
>http://lists.luaforge.net/cgi-bin/mailman/listinfo/imtoolkit-users
More information about the imtoolkit-users
mailing list