Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/367.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
Java 在android中搜索图像像素中的字符_Java_Android - Fatal编程技术网

Java 在android中搜索图像像素中的字符

Java 在android中搜索图像像素中的字符,java,android,Java,Android,我正在开发一个应用程序,我需要获得一帧的像素,然后在像素中搜索一个字符。我能够获得图像的像素,但是我无法找到在像素中搜索字符的方法,该像素已编码到我正在捕获的视频帧中。我正在使用以下代码细化像素: 包com.example import android.app.Activity; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.os.Bundle; import andro

我正在开发一个应用程序,我需要获得一帧的像素,然后在像素中搜索一个字符。我能够获得图像的像素,但是我无法找到在像素中搜索字符的方法,该像素已编码到我正在捕获的视频帧中。我正在使用以下代码细化像素:

包com.example

import android.app.Activity;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.util.Log;

public class MainActivity extends Activity {
    // a Bitmap that will act as a handle to the image
    private Bitmap bmp;

    // an integer array that will store ARGB pixel values
    private int[][] rgbValues;

    /** Called when the activity is first created. */
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        // load the image and use the bmp object to access it
        Log.v("MainActivity", "In on create");
        bmp = BitmapFactory.decodeResource(getResources(), R.drawable.test);
        Log.v("MainActivity", "bmp created:" + bmp);
        // define the array size
        rgbValues = new int[bmp.getWidth()][bmp.getHeight()];

        // Print in LogCat's console each of one the RGB and alpha values from
        // the 4 corners of the image
        // Top Left
        Log.v("MainActivity",
                "Top Left pixel: " + Integer.toHexString(bmp.getPixel(0, 0)));
        // Top Right
        Log.v("MainActivity",
                "Top Right pixel: " + Integer.toHexString(bmp.getPixel(31, 0)));
        // Bottom Left
        Log.v("MainActivity",
                "Bottom Left pixel: "
                        + Integer.toHexString(bmp.getPixel(0, 31)));
        // Bottom Right
        Log.v("MainActivity",
                "Bottom Right pixel: "
                        + Integer.toHexString(bmp.getPixel(31, 31)));

        // get the ARGB value from each pixel of the image and store it into the
        // array
        for (int i = 0; i < bmp.getWidth(); i++) {
            for (int j = 0; j < bmp.getHeight(); j++) {
                // This is a great opportunity to filter the ARGB values
                rgbValues[i][j] = bmp.getPixel(i, j);

            }
        }
        Log.v("MainActivity", "RGB values:" + rgbValues);

    }

}

“提前感谢”

是您想要的@Sharp edge:OCR不是我需要的,因为文本不在图像中,但它已使用matlab编码到视频帧中。我相信这与rgb值有关…@SanjeevKumar你的意思是什么?你说的“已经被编码到视频帧”到底是什么意思?什么是技术?@chris:我是说,我用matlab对视频进行了字符串编码……当应用程序运行时,它会捕获帧,它必须找到编码的字符串。。