2016-09-27 17:04:41 -0600
| asked a question | Difference between submat and Rect? How does submat perform in comparison to rect? In what way can we use them differently? |
2016-09-23 22:54:09 -0600
| received badge | ● Enthusiast
|
2016-09-18 02:20:52 -0600
| commented question | como alternar camera project color blob detection?? That format is so messed up ! |
2016-09-18 02:20:28 -0600
| received badge | ● Critic
(source)
|
2016-09-17 07:45:25 -0600
| asked a question | How does onTouch work completely on color blob detection? I am new to Opencv and java I'm trying to understand the onTouch method of Coloblobdetection of OpenCv. So far I have managed to define the purpose of some line and the other methods but I wont go to the step-by-step. If someone kindly at least help me understand the function of the lines below (specially the //????); what it does or what is its purpose ? I won't ask for the step-by-step but if someone could provide it is also fine. startTime = System.currentTimeMillis();// <- start elapsed time millisec;
int cols = mRgba.cols(); //gets the columns of pixels depending of resolution
int rows = mRgba.rows(); //gets the rows of pixels depending of resolution
//Toast.makeText(this,cols+" "+ rows,Toast.LENGTH_SHORT).show();
int xOffset = (mOpenCvCameraView.getWidth() - cols) / 2; //offsets are 0; distance (displacement) between the beginning of the object and a given element or point x,y axis
int yOffset = (mOpenCvCameraView.getHeight() - rows) / 2;
//Toast.makeText(this,"X offset "+xOffset+" Y offset "+yOffset,Toast.LENGTH_SHORT).show(); //<-- offset is always 0
int x = (int)event.getX() - xOffset;
int y = (int)event.getY() - yOffset;
//Toast.makeText(this,"X-axis: "+x+" Y-axis: "+y, Toast.LENGTH_SHORT).show();
Log.i(TAG, "Touch image coordinates: (" + x + ", " + y + ")");
if ((x < 0) || (y < 0) || (x > cols) || (y > rows)) return false; // <-- ?????
Rect touchedRect = new Rect();
touchedRect.x = (x>4) ? x-4 : 0; //????
touchedRect.y = (y>4) ? y-4 : 0;
touchedRect.width = (x+4 < cols) ? x + 4 - touchedRect.x : cols - touchedRect.x; //????
touchedRect.height = (y+4 < rows) ? y + 4 - touchedRect.y : rows - touchedRect.y;
Mat touchedRegionRgba = mRgba.submat(touchedRect); //???
Mat touchedRegionHsv = new Mat();
Imgproc.cvtColor(touchedRegionRgba, touchedRegionHsv, Imgproc.COLOR_RGB2HSV_FULL);
// Calculate average color of touched region
mBlobColorHsv = Core.sumElems(touchedRegionHsv);
int pointCount = touchedRect.width*touchedRect.height;
for (int i = 0; i < mBlobColorHsv.val.length; i++)
mBlobColorHsv.val[i] /= pointCount;
mBlobColorRgba = converScalarHsv2Rgba(mBlobColorHsv);
Log.i(TAG, "Touched rgba color: (" + mBlobColorRgba.val[0] + ", " + mBlobColorRgba.val[1] +
", " + mBlobColorRgba.val[2] + ", " + mBlobColorRgba.val[3] + ")");
mDetector.setHsvColor(mBlobColorHsv);
Imgproc.resize(mDetector.getSpectrum(), mSpectrum, SPECTRUM_SIZE);
mIsColorSelected = true;
touchedRegionRgba.release();
touchedRegionHsv.release();
|
2016-09-17 01:22:00 -0600
| asked a question | Difference between unsigned and signed of CvType I heard about CvType.CV_8UC4 from this site which is unsiged. What is the purpose or difference with this? How does both work? |
2016-08-31 09:30:28 -0600
| received badge | ● Editor
(source)
|
2016-08-31 09:30:02 -0600
| asked a question | Take picture with color blob detection How do I take a picture with color blob detection? I seem to have some problem merging camerabridgeviewbase and javacameraview, that is why I cannot make the capturing work. What I wanted to happen is while the colorblobdetection is displaying its result I will have the capacity to take an image out of it. Similar to this [photo] but this photo is made by taking a screenshot using(power+vol down). (https://www.imageupload.co.uk/image/BKjv) |
2016-08-31 06:39:50 -0600
| commented question | Android screenshot using Opencv My simplest question is that, is there a possibility of taking a screenshot of the phone using opencv? (the code there is plain android api but does not display the exact image) |
2016-08-30 23:34:36 -0600
| asked a question | Android screenshot using Opencv How do I make a screenshot using Opencv (android) and convert it to an Image. I myself have made a code for screenshot see link here. The output of this image is black which is not I wanted. Is there also a possibility of using a mat here? public void camera_b(View v)
{
String path = Environment.getExternalStorageDirectory().toString() + "/" + "hellp.jpg";
v = getWindow().getDecorView().getRootView();
v.setDrawingCacheEnabled(true);
Bitmap bitmap = Bitmap.createBitmap(v.getDrawingCache());
v.setDrawingCacheEnabled(false);
OutputStream out = null;
File imageFile = new File(path);
try {
out = new FileOutputStream(imageFile);
// choose JPEG format
bitmap.compress(Bitmap.CompressFormat.JPEG, 90, out);
out.flush();
} catch (FileNotFoundException e) {
// manage exception
} catch (IOException e) {
// manage exception
} finally {
try {
if (out != null) {
out.close();
}
} catch (Exception exc) {
}
}
}
|