artyom-beilis / OpenLiveStacker

Live Stacker Project - C++ backend and frontend
GNU General Public License v3.0
32 stars 4 forks source link

Stacking produces an image containing only value zero #3

Closed han-k59 closed 1 year ago

han-k59 commented 1 year ago

With my ASI1600 camera, S7 phone and Android 8, streaming works but stacking produces TIFF files where all pixels have value 0. Attached some log files.

OpenliveStacker3.zip

artyom-beilis commented 1 year ago

Can you please record several frames - i.e. set "Save Debug" during stacking and do a very short few frames stack.

Under debug directory you'll see the raw (tiff) images before stacking I can analize.

It seems there is some kind of bug regarding handling mono camera (since I don't own)

BTW. Do you have Linux? Because it may be way simpler to debug this kind of stuff directly on Linux rather then Android.

artyom-beilis commented 1 year ago

After reviewing the code once again. I really need to see the tiff frames saved via debug (very short stack)

han-k59 commented 1 year ago

Stacking of the simulated image M44 works. In debug folder I can see the individual images

Still have some problem with starting the app. It asks twice to allow using the USB. Then nothing happens. After close it seems to work with ASI selection, but didn't got an astro image yet. Phone battery is empty now and I'm recharging now

han-k59 commented 1 year ago

In debug mode the frames are written correctly to folder debug. Also stacking seems to work but no stack file is produced. So there are the following problems:

1) Still have some problem with starting the app. It asks twice to allow using the USB. Then nothing happens. After close it works with the ASI selection.

2) Stream image stays green. No sky image is shown.

3) Stacking. Sky images are made and written to debug folder !!!. See attached.

4) No stack result is found in folder stack.

5) After return, the camera is not functioning anymore. No respons. Application show only menu option EXIT. After restart camera no response. Restart openlivestacker application plus briefly decoupling USB cable camera is required to restart

Some images plus logs: OpenliveStacker5.zip

han-k59 commented 1 year ago

Here a screenshot of the stacking

Screenshot_20230425-234912_Samsung Internet

artyom-beilis commented 1 year ago

In order to save the result you need to press "Save" button. It stops the stacking and saves the result.

artyom-beilis commented 1 year ago

BTW did you manage to reporduce and record these "zero" images?

han-k59 commented 1 year ago

The strange thing stacking seems to work within simulation, but not with my ASI1600 images. The stack folder was empty but I had 5 folder with debug images.

Therefore it would be nice to set a path to a simulation image (see other issue). Maybe it has something to do with the image size or being mono.

han-k59 commented 1 year ago

For me stacking is not so highly important. Just saving images to a SD card would be nice. Stacking can be done later. Having a 32 gbyte SD card would allow to store about 900 images of 32mbytes. Assuming the exposure time is 6 seconds plus a few seconds for downloading. That would allow 9000 seconds or 2.5 hours exposing. Stacking and filtering of the good and bad images can be done later.

A second phone with a guide app would make it even better :)

artyom-beilis commented 1 year ago

The strange thing stacking seems to work within simulation, but not with my ASI1600 images. The stack folder was empty but I had 5 folder with debug images.

Therefore it would be nice to set a path to a simulation image (see other issue). Maybe it has something to do with the image size or being mono.

Please collect logs and debug images.

Generally when you press "save" icon the stacking finished and result is saved. We are back to live video view.

You can also "pause" the stacking to review result before pressing save.

han-k59 commented 1 year ago

I did some more testing. Often it does not work and I'm pretty sure it is the communication with the camera. The stacking gets more reliable with the camera is set at bin4x4 8 bit, so the smallest size. Not with the full size 4656x 3520 pixels, 16 bit.

Anyhow if it works, I get a stack and can save them. They do contain camera noise. So I assume the zero values where from a camera failure/communication failure. Attached the logs and below one image where communication stopped halfway. The counter stopped at 1/0/0.

OpenliveStacker6.zip

Untitled

artyom-beilis commented 1 year ago

It may also be registration issue.

Please record frames (with save) so I can run it offline

Also note I see that it seems with large frames 4656x3520 processing time is too large:

log.txt.6:2023-04-26 11:39:24; stacker, info: Stacking took 1464.68 ms, generation 1292.35 ms, jpeg took=685.633 (processors.cpp:445)

It takes 1.5s registration and stacking. 1.2s postprocessing (stretch) and 0.6s jpeg compression (i.e. generation of live stream)

Sometimes in log I see numbers like these:

Stacking took 4872.48 ms, generation 1310.74 ms, jpeg took=1628.24 (processors.cpp:445)

So unless you have exposure times of maybe 5-10 seconds I don't see how processing power of the smartphone can handle full frame.

I think need to add support of ROI for ASI cameras of an object you are capturing is small.

Also for live stacking there is no reason to have something more than full HD frame (like 1920x1080) since you anyway will be limited by screen size.

han-k59 commented 1 year ago

Attached some more star images in bin2x2 from yesterday. position : 13: 20 38.9 +75° 48 01
FOV (height) about 1.3 degrees. So FL=580 mm, Pixel size 5.6 micrometer

Binning 1x1 is too much, but binning 2x2 like attached would be normal for the typical seeing. Sensor cooling is off so the images are much more noisy then usual. Exposure time, i can't remember but a few seconds.

I would see ROI as a last remedy. Better not to use it.

OpenliveStacker5b.zip

You said something about test a Linux version. I can boot my PC to Linux next to my telescope.

artyom-beilis commented 1 year ago

I run it offline and it all stacked correctly.

But not all images are saved. In the log there are 11 images but only 3 were saved. Saving may be real bottleneck for Android. But without it you'll have high chances of working well with it.

I need to think what else can I optimize but it is harsh for handheld device :-)

artyom-beilis commented 1 year ago

Clearsky2_Trst2_20230425_234810_stacked

Here is the stacking of 3 images result

han-k59 commented 1 year ago

There where 11 images saved. I tried to copy them to my old Mac laptop running Windows on a small partition but was running out of disk space. So I saved only three images. I did delete the others from the phone also to make some space. So an option to save the images to SD would be nice.

A soon it is clear sky I will make new images. Then with camera cooling on and pointed to an interesting object.

artyom-beilis commented 1 year ago

So an option to save the images to SD would be nice.

Ok this is indeed important. I got you.

Then with camera cooling on and pointed to an interesting object.

Which reminds me to add cooling/temperature controls and not only Gain + Exposure for ASI.

han-k59 commented 1 year ago

Yes forgot that. Applying 12VDC to the camera is not enough. It requires an setpoint (:

artyom-beilis commented 1 year ago

It requires an setpoint (:

If so I'll add this feature and I'll have somebody to test it :-)

artyom-beilis commented 1 year ago

Yes forgot that. Applying 12VDC to the camera is not enough. It requires an setpoint (:

Added it into beta6.

Also did some rework on controls. Apparently ASI camera starts with auto exposure and white balance and I didn't disabled them.

So one you can please check cooler controls. I don't have cooled camera so your help will be very important

artyom-beilis commented 1 year ago

Ok I think I'm closing it meanwhile since it seems to be working (for now)