Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/image-processing/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Algorithm 一种按行和按列读取图像的算法?_Algorithm_Image Processing_Extract - Fatal编程技术网

Algorithm 一种按行和按列读取图像的算法?

Algorithm 一种按行和按列读取图像的算法?,algorithm,image-processing,extract,Algorithm,Image Processing,Extract,有人能帮我读取和提取图像行和列的信息吗 我的努力是从乐谱中提取信息 音乐壁图像示例: 对于由多个壁线组成的图像,我需要按顺序逐壁提取数据壁 有人能帮我翻译一下代码片段吗?制作一个逐行提取的算法 无论您做什么,都会“按行/按列”提取图像中的信息;请记住,图像是从像素(即小正方形)进行分析的。它一个接一个地读这些小正方形 图像处理的难点在于处理特定的几何问题。例如:逐行从中提取一个复杂的形状,如链接中的一个横杠 这里有一个小代码(用C#.NET编写)提供了所需算法的简单版本:它通过影响单个变量来逐

有人能帮我读取和提取图像行和列的信息吗

我的努力是从乐谱中提取信息

音乐壁图像示例:

对于由多个壁线组成的图像,我需要按顺序逐壁提取数据壁


有人能帮我翻译一下代码片段吗?制作一个逐行提取的算法

无论您做什么,都会“按行/按列”提取图像中的信息;请记住,图像是从像素(即小正方形)进行分析的。它一个接一个地读这些小正方形

图像处理的难点在于处理特定的几何问题。例如:逐行从中提取一个复杂的形状,如链接中的一个横杠

这里有一个小代码(用C#.NET编写)提供了所需算法的简单版本:它通过影响单个变量来逐行或逐列读取(
readvertical
)。我想这是一个很好的介绍,可以帮助您:

private void readImage(string imagePath)
{
    Bitmap imageBitMap = (Bitmap)Bitmap.FromFile(imagePath);

    bool readVertically = true; //This flag tells where the image will be analysed vertically (true) or horizontally (false)

    int firstVarMax = imageBitMap.Width; //Max. X
    int secondVarMax = imageBitMap.Height; //Max. Y
    if (!readVertically)
    {
        firstVarMax = imageBitMap.Height;
        secondVarMax = imageBitMap.Width;
    }

    for (int firstVar = 0; firstVar < firstVarMax; ++firstVar)
    {
        for (int secondVar = 0; secondVar < secondVarMax; ++secondVar)
        {
            //Color of the given pixel. Here you can do all the actions you wish (e.g., writing these pixels to other file)
            if (readVertically)
            {
                Color pixelColor = imageBitMap.GetPixel(firstVar, secondVar);
            }
            else
            {
                Color pixelColor = imageBitMap.GetPixel(secondVar, firstVar);
            }
        }
    }
}
private void readImage(字符串imagePath)
{
位图图像位图=(位图)位图.FromFile(图像路径);
bool readvertical=true;//此标志指示将在何处垂直(true)或水平(false)分析图像
int firstVarMax=imageBitMap.Width;//Max.X
int secondVarMax=imageBitMap.Height;//Max.Y
如果(!ReadVertical)
{
firstVarMax=imageBitMap.Height;
secondVarMax=imageBitMap.Width;
}
对于(int firstVar=0;firstVar
非常感谢您提供的代码。通过添加以下内容,我成功地修改了您的代码<代码>字节像素=像素颜色.B我很高兴知道它帮助您开发了您想要的东西。