Detect dark image application: code that needs fixing -- 2

Due to work related travel , I had postponed this project for my hobby.

I am reopening it again to get help with fixing the code of a simple app that checks the front camera for when the image goes dark. ( suggest code provided )


-Must be an Eclipse format file

-Single screen app

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

- Must have a method/function 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) {


mSurfaceView = new SurfaceView(context);


// 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 -----

Beceriler: Android, Mobile App Development

Daha fazlasını gör: get started with android, current android version, context android, code that, change default app android, android viewgroup, android surfaceview, android gingerbread, android context, android application class, r travel, r image processing, image processing in r, g-pixel, g-code, detect mobile, android travel, android fixing, popup android simple, android application front end, android camera image processing example, file byte array, image processing using android phone, travel app android, image processing application

İşveren Hakkında:
( 3 değerlendirme ) Tuebingen, Germany

Proje NO: #6498306



Hi, Dear cheSteve!!! Thanks for your beautiful posting. I am a full-time freelancer who has rich experiences in developing android app. i have been understand what you want and i can do it wonderfully. if you check me, Daha Fazla

%selectedBids___i_period_sub_7% gün içinde 24%project_currencyDetails_sign_sub_9% %project_currencyDetails_code_sub_10%
(10 Değerlendirme)

4 freelancers are bidding on average €32 for this job


Dear Sir, Trust us we can do this project as we had done similar project of our clients. We want to work with you and build a healthy longterm relationship so please contact us and discuss for this project befor Daha Fazla

in %bids___i_period_sub_35% gün içinde30%project_currencyDetails_sign_sub_37% %project_currencyDetails_code_sub_38%
(50 Değerlendirme)

Hi, Your search ends here. I have Excellence, Innovation, Expertise team and all have more than 2 yr. experience in app development and our goal is to deliver app with Our honesty, expertise, safety and timely manner. Daha Fazla

1 gün içinde %bids___i_sum_sub_32%%project_currencyDetails_sign_sub_33% EUR
(14 Değerlendirme)

Hi, 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 thi Daha Fazla

1 gün içinde %bids___i_sum_sub_32%%project_currencyDetails_sign_sub_33% EUR
(1 Yorum)

Hi. First of all, Thank you for sending me invitation for bid on this project. I understand your code. I am implementing it and let me test it. I will let you know very soon. Thanks & Best Regards, Nikhil

1 gün içinde %bids___i_sum_sub_32%%project_currencyDetails_sign_sub_33% EUR
(0 Değerlendirme)