isle Posted at 5/22/2017 09:43
Hi ,yes It is possible,
In Android, It is a device of camera, so, see the class of android.hardware …
Hello isle, good to know that it works! So I import android.hardware classes to android studio ?
Is there any sample code I might look at to understand how to capture the frames?
If it is recognized as a camera device, will this work with no modifications?
int main(int, char**)
{
VideoCapture cap(0); // open the default camera
if(!cap.isOpened()) // check if we succeeded
return -1;
I need help, i got it working but the frame rate is very slow (10-20 fps). I need atleast constant 30 fps and above. can you look at this and help me out? thanks!!
i ad 2 posts witrh my code ands third posat with a pictue of the result!
public class MainActivity_show_camera extends AppCompatActivity implements CvCameraViewListener2 {
VideoCapture vcap = new VideoCapture(0);
// Used for logging success or failure messages
private static final String TAG = "OCVSample::Activity";
// Loads camera view of OpenCV for us to use. This lets us see using OpenCV
private CameraBridgeViewBase mOpenCvCameraView;
// Used in Camera selection from menu (when implemented)
private boolean mIsJavaCamera = true;
private MenuItem mItemSwitchCamera = null;
// These variables are used (at the moment) to fix camera orientation from 270degree to 0degree
Mat mRgba;
Mat mRgbaF;
Mat mRgbaT;
private BaseLoaderCallback mLoaderCallback = new BaseLoaderCallback(this) {
@Override
public void onManagerConnected(int status) {
switch (status) {
case LoaderCallbackInterface.SUCCESS:
{
Log.i(TAG, "OpenCV loaded successfully");
mOpenCvCameraView.enableView();
} break;
default:
{
super.onManagerConnected(status);
} break;
}
}
};
public MainActivity_show_camera() {
Log.i(TAG, "Instantiated new " + this.getClass());
}
@Override
protected void onCreate(Bundle savedInstanceState) {
Log.i(TAG, "called onCreate");
super.onCreate(savedInstanceState);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
setContentView(R.layout.show_camera_activity_java_surface_view);
mOpenCvCameraView = (JavaCameraView) findViewById(R.id.show_camera_activity_java_surface_view);
mOpenCvCameraView.setVisibility(SurfaceView.VISIBLE);
mOpenCvCameraView.setCvCameraViewListener(this);
}
@Override
public void onPause()
{
super.onPause();
if (mOpenCvCameraView != null)
mOpenCvCameraView.disableView();
}
@Override
public void onResume()
{
super.onResume();
if (!OpenCVLoader.initDebug()) {
Log.d(TAG, "Internal OpenCV library not found. Using OpenCV Manager for initialization");
OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_3_0_0, this, mLoaderCallback);
} else {
Log.d(TAG, "OpenCV library found inside package. Using it!");
mLoaderCallback.onManagerConnected(LoaderCallbackInterface.SUCCESS);
}
}
public void onDestroy() {
super.onDestroy();
if (mOpenCvCameraView != null)
mOpenCvCameraView.disableView();
}
public void onCameraViewStarted(int width, int height) {
mRgba = new Mat(height, width, CvType.CV_8UC4);
mRgbaF = new Mat(height, width, CvType.CV_8UC4);
mRgbaT = new Mat(width, width, CvType.CV_8UC4);
}
public void onCameraViewStopped() {
mRgba.release();
}
public Mat onCameraFrame(CvCameraViewFrame inputFrame) {
// TODO Auto-generated method stub
mRgba = inputFrame.rgba();
// Rotate mRgba 90 degrees
return mRgba; // This function must return
}
this is the result: HDMI input in firefly RK 3288 reload. very low FPS and bad rtesolution (this is windows desktop from my PC going into the HDMI input and displayed on the TV). any ideas?
Hi Hanban, were you able to boost your framerate or make any improvement? I’m just getting started on something similar and on the look-out for any tips or gotchas that folks with experience can provide.
The viewpoints in the article have been very beneficial to my work. HPE6-A88 test registration test questions available for free—get ready for promotions and salary growth!
This article has made me reflect on many things, and I’ve learned quite a bit. Unlock career success with the free Valid 1Y0-231 study notes exam questions—boost your promotion and salary!
I’m really inspired after reading this article, thanks so much for sharing! These NPPE Test Questions questions were the reason for my success, and now I’m offering them to you for free!