Detect dark image application: code that needs fixing

Geschlossen Veröffentlicht Sep 2, 2014 Bezahlt bei Lieferung
Geschlossen Bezahlt bei Lieferung

I need help with a simple app that checks the front camera for when the image goes dark. - suggest code provided -

- The threshold value should be kept in a variable that i can change for testing.

- Must have a method with the code to be executed when the threshold is reached (see example below - onPreviewFrame() ). For testing it should just show a popup with the current luminance value.

- It should work with the lowest Android version possible (anything Gingerbread or higher hopefully )

That is it. I hope this is as simple as i think and welcome any suggestions regarding this posting.

I found an example in Stackoverflow that might get it started:

[url removed, login to view]

----- from stack overflow --------

This is fairly straightforward. You should use a surfaceview and camera preview. That way you get each frame as a byte array. The default format for the frame is YUV, which is Y (luminance) and UV, which are chrominance. You can use Y to calculate average luminance in the image. If you're using BGR, you can calculate luminance using: Y = 0.2126 R + 0.7152 G + 0.0722 B

class Preview extends ViewGroup implements [url removed, login to view] {

SurfaceView mSurfaceView;

SurfaceHolder mHolder;

Preview(Context context) {

super(context);

mSurfaceView = new SurfaceView(context);

addView(mSurfaceView);

// Install a [url removed, login to view] so we get notified when the

// underlying surface is created and destroyed.

mHolder = [url removed, login to view]();

[url removed, login to view](this);

[url removed, login to view](SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);

}

... }

adding the callback to your class, means for every frame this method is called:

onPreviewFrame(byte [] frame, Camera cam){

//do some processing

//

}

--- end of stackoverflow -----

---- Here are two posts that explain how to calculate/decode the luma from the ----

http://stackoverflow.com/questions/10684220/manipulating-luma-in-yuv-color-space
http://stackoverflow.com/questions/4033410/yuv-decode-function-error-or-hardware-problem ( not directly calculating luma here but has some interesing YUV functions)

The goal of this code is a small app that:
- will continously check the image from the front camera (without showing it on the phone/tablet screen: the screen remains black ! )
- No interface nor menu/buttons show up; only a black screen
- when the average luma surpasses a threshold, show a pop up with the value (only notification required)
- requires only these two functions and will not be uploaded to Playstore at any moment

Android Mobile App Entwicklung

Projekt-ID: #6403385

Über das Projekt

7 Vorschläge Remote Projekt Aktiv Oct 9, 2014

7 Freelancer bieten im Durchschnitt €358 für diesen Job

Sibext

Предложение еще не подано

€1500 EUR in 12 Tagen
(6 Bewertungen)
3.3
dbkaiser

一个有效的提议尚未被提供

€211 EUR in 30 Tagen
(1 Bewertung)
0.4
Nikhil3398

Dear, sir. I have just read your requirement carefully and had very interesting in your project. I have a lot of experiences in development of Iphone/Ipad/Android game for Cocos2D, Box2D, ... , so developing your Mehr

€23 EUR in 1 Tag
(0 Bewertungen)
0.0
Charlie50

A proposal has not yet been provided

€23 EUR in 20 Tagen
(0 Bewertungen)
0.0
SARGAM9

Sir , I am a student of CA and do part time work. I am doing work on EXCEL & MS WORD since long back and also I am CONFIDENT to give you desired results within designed time frame. I expect very positively Mehr

€30 EUR in 1 Tag
(0 Bewertungen)
0.0
kingstar224

Dear Sir. "High Quality + Powerful Service + Rapid Communication!" is my forever business policy! I just read your job posting with interest and carefully, and I’ll waiting interview with you ardently because this j Mehr

€333 EUR in 5 Tagen
(0 Bewertungen)
0.0