Issue
i'm trying to open a jpeg file which is a drawable of my app. Following this method I have no idea about how to set the variable "context" (that is the first parameter of the function loadResource).
My aim is just to load this image, extract some feature and compare it with the frames grabbed from camera. And to this end I would like some good suggested tutorial (i will use some feature matching method).
thanks a lot!
Solution
You need to learn more about Context.
Use getApplicationContext()
:
Mat img = Utils.loadResource(getApplicationContext(), refrenceimgID, Highgui.CV_LOAD_IMAGE_COLOR);
Or if your code is on an activity, use this
:
Mat img = Utils.loadResource(this, refrenceimgID, Highgui.CV_LOAD_IMAGE_COLOR);
or YourActivityName.this
:
Mat img = Utils.loadResource(YourActivityName.this, refrenceimgID, Highgui.CV_LOAD_IMAGE_COLOR);
Answered By - RyanB
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.