mirror of https://github.com/opencv/opencv.git
commit
e10ee89ec4
194 changed files with 1358 additions and 147097 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
@ -0,0 +1,11 @@ |
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<resources> |
||||
<declare-styleable name = "CameraBridgeViewBase" > |
||||
<attr name="show_fps" format="boolean"/> |
||||
<attr name="camera_id" format="integer" > |
||||
<enum name="any" value="-1" /> |
||||
<enum name="back" value="0" /> |
||||
<enum name="front" value="1" /> |
||||
</attr> |
||||
</declare-styleable> |
||||
</resources> |
@ -0,0 +1,66 @@ |
||||
package org.opencv.android; |
||||
|
||||
import java.text.DecimalFormat; |
||||
|
||||
import org.opencv.core.Core; |
||||
|
||||
import android.graphics.Canvas; |
||||
import android.graphics.Color; |
||||
import android.graphics.Paint; |
||||
import android.util.Log; |
||||
|
||||
public class FpsMeter { |
||||
private static final String TAG = "FpsMeter"; |
||||
private static final int STEP = 20; |
||||
private static final DecimalFormat FPS_FORMAT = new DecimalFormat("0.00"); |
||||
|
||||
private int mFramesCouner; |
||||
private double mFrequency; |
||||
private long mprevFrameTime; |
||||
private String mStrfps; |
||||
Paint mPaint; |
||||
boolean mIsInitialized = false; |
||||
int mWidth = 0; |
||||
int mHeight = 0; |
||||
|
||||
public void init() { |
||||
mFramesCouner = 0; |
||||
mFrequency = Core.getTickFrequency(); |
||||
mprevFrameTime = Core.getTickCount(); |
||||
mStrfps = ""; |
||||
|
||||
mPaint = new Paint(); |
||||
mPaint.setColor(Color.BLUE); |
||||
mPaint.setTextSize(20); |
||||
} |
||||
|
||||
public void measure() { |
||||
if (!mIsInitialized) { |
||||
init(); |
||||
mIsInitialized = true; |
||||
} else { |
||||
mFramesCouner++; |
||||
if (mFramesCouner % STEP == 0) { |
||||
long time = Core.getTickCount(); |
||||
double fps = STEP * mFrequency / (time - mprevFrameTime); |
||||
mprevFrameTime = time; |
||||
if (mWidth != 0 && mHeight != 0) |
||||
mStrfps = FPS_FORMAT.format(fps) + " FPS@" + Integer.valueOf(mWidth) + "x" + Integer.valueOf(mHeight); |
||||
else |
||||
mStrfps = FPS_FORMAT.format(fps) + " FPS"; |
||||
Log.i(TAG, mStrfps); |
||||
} |
||||
} |
||||
} |
||||
|
||||
public void setResolution(int width, int height) { |
||||
mWidth = width; |
||||
mHeight = height; |
||||
} |
||||
|
||||
public void draw(Canvas canvas, float offsetx, float offsety) { |
||||
Log.d(TAG, mStrfps); |
||||
canvas.drawText(mStrfps, offsetx, offsety, mPaint); |
||||
} |
||||
|
||||
} |
@ -1 +1,3 @@ |
||||
#/usr/bin/env python |
||||
|
||||
from cv2.cv import * |
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue