如何在矩阵中保存图像的像素值? [英] How to save pixel values of a image in a matrix?

查看:299
本文介绍了如何在矩阵中保存图像的像素值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好。

我想要一个algo或c-program,可以将图像像素值保存在矩阵中,就像我们在MATLAB中一样

我有一个bmp图像哪个黑白只是它的像素值只有0或255(黑色或白色)

现在我想将所有像素值保存在c-program中的2D矩阵中>
所以,有什么办法吗?



我尝试过的事情:



我使用了Cimg和imagemagick它们非常慢。

hello guys.
I want to have a algo or c-program that can save image pixel values in a matrix similar like we do in MATLAB
I have a bmp image which black and white only that its pixel values is only 0 or 255 (black or white)
Now I want to save all that pixel values in a 2D matrix in a c-program
so, is there any way to this?

What I have tried:

I used Cimg and imagemagick they are very slow.

推荐答案

一个算法:

An algo:
for each row
    for each col
        read pixel
        save in matrix


我知道算法但是C直接没有读取带文件处理的位图图像
I know that algo but C directly did not read bit map images with file handling


这篇关于如何在矩阵中保存图像的像素值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆