OpenCV with Android Capture Images -


what best way capture images in android , process them opencv ? should use surface view as here or should use opencv camera in opencv samples ? , how can load captured image , convert mat? in advance

 private picturecallback mpicture = new picturecallback() {          @override     public void onpicturetaken(byte[] data, camera camera) {          file picturefile = getoutputmediafile(media_type_image);         if (picturefile == null) {             log.d("e",                     "error creating media file, check storage permissions ");             return;         }          try {              fileoutputstream fos = new fileoutputstream(picturefile);             fos.write(data);             fos.close();             //processimage();         } catch (filenotfoundexception e) {             log.d("e", "file not found: " + e.getmessage());         } catch (ioexception e) {             log.d("e", "error accessing file: " + e.getmessage());         }     } 

in opencv samples there camerabridgeviewbase helps in capturing, processing , showing results of camera preview (continuous stream of lower resolution images).

if want process single capture more resolution, should use similar onpicturetaken(). can read image using highgui.imread() , process it.

you avoid writing , reading file creating bitmap data array bitmapfactory.decodebytearray() , converting bitmap mat using utils.bitmaptomat()


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -