从Android中的JPEG图像中提取近红外(NIR)通道

时间:2022-05-07 21:21:51

I am a beginner in image processing in Android. I am trying to build an application in which I need to separate the color channels from an image and perform calculations on them.

我是Android图像处理的初学者。我正在尝试构建一个应用程序,在这个应用程序中,我需要将颜色通道与图像分开,并对它们进行计算。

I have successfully extracted RGB channels from the image. I am using the code fragment given in these tutorials: https://xjaphx.wordpress.com/2011/06/21/image-processing-filter-color-channels/

我已经成功地从图像中提取了RGB通道。我正在使用这些教程中给出的代码片段:https://xjaphx.wordpress.com/2011/06/21/image-processing-fil-color -channels/

Here is the code fragment:

下面是代码片段:

public static Bitmap doColorFilter(Bitmap src, double red, double green, double blue) {
        int width = src.getWidth();
        int height = src.getHeight();

        Bitmap bmOut = Bitmap.createBitmap(width, height, src.getConfig());

        int A, R, G, B;
        int pixel;

        for(int x = 0; x < width; ++x) {
            for(int y = 0; y < height; ++y) {

                pixel = src.getPixel(x, y);

                A = Color.alpha(pixel);
                R = (int)(Color.red(pixel) * red);
                G = (int)(Color.green(pixel) * green);
                B = (int)(Color.blue(pixel) * blue);

                bmOut.setPixel(x, y, Color.argb(A, R, G, B));
            }
        }


        return bmOut;
    }
}

But I am unable to figure out the way to extract NIR channel from the image. My aim to extract this NIR channel is because I need to apply the NDVI (Normalised Difference Vegetation Index) indicator on the image for analysis.

但是我无法找到从图像中提取NIR通道的方法。我提取这个NIR通道的目的是因为我需要在图像上应用NDVI (Normalised Difference Vegetation Index)指标进行分析。

Also, in this piece of code, brute-force approach has been used by running multiple for loops. Thus, the program becomes really slow with the complexity being - O(width*height). What would be an efficient way for computation of these separate channels?

同样,在这段代码中,蛮力方法已经被用于运行多个for循环。因此,程序变得非常慢,复杂度为- O(宽度*高度)。如何有效地计算这些单独的通道呢?

Screen shot of image properties:

图像属性的屏幕截图:

从Android中的JPEG图像中提取近红外(NIR)通道

从Android中的JPEG图像中提取近红外(NIR)通道

从Android中的JPEG图像中提取近红外(NIR)通道

Kindly help me with this issue.

请帮我解决这个问题。

1 个解决方案

#1


1  

From the manufacturers website:

从制造商的网站:

NDVI Red + NIR

归一化植被指数红+近红外光谱

This camera has a dual-band filter that captured reflected Red light in the RGB sensor's red channel and reflected Near Infrared light in the RGB sensor's blue channel. You can thus use this single camera to compute the NDVI indice, though the contrast in the resulting index image will not be as "accurate" as using the separate Red and NIR camera models.

这款相机有一个双波段滤光器,它捕捉到RGB传感器的红色通道反射的红光,并在RGB传感器的蓝色通道中反射近红外光。因此,您可以使用这个单独的相机来计算NDVI标记,尽管生成的索引图像中的对比度不会像使用单独的红色和NIR相机模型那样“准确”。

#1


1  

From the manufacturers website:

从制造商的网站:

NDVI Red + NIR

归一化植被指数红+近红外光谱

This camera has a dual-band filter that captured reflected Red light in the RGB sensor's red channel and reflected Near Infrared light in the RGB sensor's blue channel. You can thus use this single camera to compute the NDVI indice, though the contrast in the resulting index image will not be as "accurate" as using the separate Red and NIR camera models.

这款相机有一个双波段滤光器,它捕捉到RGB传感器的红色通道反射的红光,并在RGB传感器的蓝色通道中反射近红外光。因此,您可以使用这个单独的相机来计算NDVI标记,尽管生成的索引图像中的对比度不会像使用单独的红色和NIR相机模型那样“准确”。