elktownlabs / murgcam

Autonomous, time-based, low power still camera
0 stars 0 forks source link

Finish refphoto function #48

Closed sirtet closed 1 year ago

sirtet commented 1 year ago

The current implementation only returns the same sample jpg for all calibration points:

https://github.com/elktownlabs/murgcam/blob/23df4dbb274391b16a67ac1fe7236453216c96b4/web-backend/api/rivermap.php#L208-L219

i added a Folder ref in admin/photos and deliver photos from there:

208 ////////////////////////////////////
209 // -- API subfunction refphoto -- //
210 ////////////////////////////////////
211 // Returns a list of all files matching the provided search criteria
212
213 if(isset($_GET['refphoto'])) {
214     $reflabel = $_GET['refphoto'];
215     header('Content-Type: image/jpeg');
216     header('Content-Disposition: inline');
217     switch ($reflabel) {
218         case 'min':
219             print(file_get_contents("../photos/ref/min.jpg"));
220             break;
221         case 'med':
222             print(file_get_contents("../photos/ref/med.jpg"));
223             break;
224         case 'max':
225             print(file_get_contents("../photos/ref/max.jpg"));
226     }
227     exit(0);
228   }

This works. Was/is there a plan for how the final implementation should look like? I think it's a good idea to have the ref-images close to the cam_ photos, they are both "user"-Data, and it gets a bit easyer to copy/move files around.

How i work with this Setup is:

  1. browse for a good ref. image in the UI,
  2. then copy that to eg. ref/min-cam_6409f5d877458.jpg possibly also peter-p-min-cam_6409f5d877458.jpg for someone else's recommendation.
  3. Then, whichever i decide to currently use, i copy to min.jpg
  4. When i don't have a proper ref.Image yet, i add some text to the image. Commandline example: convert -pointsize 60 -fill white -annotate +100+150 'Reference Image missing.\nThe red Mark should roughly be High flow.' min-cam_6409f5d877458.jpg max.jpg
elktownlabs commented 1 year ago

The reference images are now on the MurgCam server and the refphoto function implemented as suggested above.