使用锯齿状数组在C中表示签名 [英] Representation of signature in c using jagged array
问题描述
他们的朋友们得到了一个名为i的项目,我是一个初学者,并且知道链表的概念.但是我不知道如何使用锯齿状数组读取c中的图像.
Hi their friends i have been given with a project named such i am a beginner and know the concept of linked list. But i don''t no how to read a image in c using jagged arrays.
This project is to read a image and get the black color read and store it into the list
我不知道锯齿状数组的概念可以为您提供一些帮助:((:((.我需要用于读取数据并将其存储的模块:sigh:.可以给阅读模块的代码,我将永远感谢您.
i don''t know the concept of jagged arrays can some one help please :(( :(( . I need the module which is used to read the data and storing it :sigh: . please give some info also if can give the code of the reading module i would be thankfulllllllllll to u forever. Thanks in advance
推荐答案
锯齿状数组"是二维数组的表示形式使用一个指针数组,该指针是其他数组的地址.
例如,它们在represtentig字符串集中是典型的.
如果是图片,您可以考虑使用COLORREF
类型表示像素,
一个COLORREF*
来处理像素的动态数组(一行)和一个COLORREF**
解决一系列行(图像本身).
它会给你类似的东西
A "jagged array" is a representation of a bi-dimensional array using an array of pointers that are addresses of other arrays.
They are typical for example, in represtentig set of strings.
In case of images, you can think to aCOLORREF
type to represent a pixel,
aCOLORREF*
to address a dynamic array of pixels (a row) and aCOLORREF**
to address a sequence of rows (the image itself).
It will give you something similar to
COLORREF** image = malloc(nrows * sizeof(COLORREF*));
for(unsigned i=0; i<nrows; ++i) image[i] = malloc(pixel_in_a_row * sizeof(COLORREF));
进行此类初始化之后,image [r] [c]将代表行r和列c的像素.
关于读取和存储",有各种标准格式(JPG,PNG,BMP等).存储真彩色"(每像素24或32位)图像时,最简单的一种可能是BMP.
只需检查有关位图文件格式"的MSDN.
当然,记得最后将free
所有malloc
都包括在内!
After such an initialization, image[r][c] will represent the pixel at row r and column c.
About "reading and storing" there are various standard format (JPG, PNG, BMP, ...). The simpler one is probably the BMP when storing "true colors"(24 or 32 bits per pixel) image.
Just check the MSDN about "Bitmap File Format".
Of course remember to free
all what you malloc
at end !
这篇关于使用锯齿状数组在C中表示签名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!