Commit Graph

459 Commits

Author SHA1 Message Date
Benjamin Loison
31b979edb3
Override print to also print current time 2024-04-30 03:21:32 +02:00
Benjamin Loison
c9f75286bf
Make merge_single_color_channel_images_according_to_bayer_filter.py
virtual environment friendly
2024-04-30 03:20:44 +02:00
Benjamin Loison
ab9466c738
#62: Optimize significantly mergeSingleColorChannelImagesAccordingToBayerFilter 2024-04-30 03:17:19 +02:00
Benjamin Loison
2d67c2bca1
Add and use rescaleRawImageForDenoiser and updateExtremes (#59) 2024-04-30 02:04:17 +02:00
Benjamin Loison
671a692114
#59: Save rmss for futher investigations
For instance to plot a fair comparison, see [issues/59#issuecomment-1732](#59 (comment)).
2024-04-30 01:04:33 +02:00
5647ab4019
#59: Should make split_and_compare_prnus_of_subgroups.py compatible with RAW images 2024-04-27 23:13:48 +02:00
9b2f2281e4
Make merge_single_color_channel_images_according_to_bayer_filter.py more general 2024-04-27 22:57:29 +02:00
5ea0a862c0
Add and use getColorChannel 2024-04-27 21:49:32 +02:00
561ec9d1e0
Add and use escapeFilePath 2024-04-27 21:48:07 +02:00
b50f013234
Add and use isARawImage 2024-04-27 21:46:40 +02:00
a0fc38d023
Add and use getRawColorChannel to utils.py 2024-04-27 20:47:33 +02:00
Benjamin Loison
80a33428d6
Make split_and_compare_prnus_of_subgroups.py execution compatible with chaining shell commands
Otherwise it is stuck on `plt.show` until it is closed but we want to
chain with a notification command, so the notification is not
interesting in this case.
2024-04-27 19:36:45 +02:00
Benjamin Loison
9d8e5ddbec
Make split_and_compare_prnus_of_subgroups.py only use 2 images of RAM
quantity
2024-04-27 19:24:12 +02:00
Benjamin Loison
4ac75448a6
Correct in theory the range of color values 2024-04-27 17:54:16 +02:00
Benjamin Loison
643fee9f4a
Make split_and_compare_prnus_of_subgroups.py executable from terminal
Used to be only executable from Pyzo.
2024-04-27 16:55:03 +02:00
c8fe71444f
#59: Leverage iterativeMean to not suffer of RAM quantity issue 2024-04-27 16:49:06 +02:00
Benjamin Loison
6f6721da8d
Make merge_single_color_channel_images_according_to_bayer_filter.py executable from terminal
Used to only run in Pyzo.
2024-04-27 16:20:02 +02:00
b0fa01c6c4
Remove potential chronological bias 2024-04-27 16:10:20 +02:00
e9dc28dc2a
Simplify and clean split_and_compare_prnus_of_subgroups.py 2024-04-27 16:06:47 +02:00
Benjamin Loison
ee7353cfde
Correct iterativeMean implementation for images
Otherwise get:

```
Traceback (most recent call last):
  File "/home/benjamin/robust_image_source_identification_on_modern_smartphones/datasets/raise/./extract_noise.py", line 148, in <module>
    treatImage(imageFileName, color = color)
  File "/home/benjamin/robust_image_source_identification_on_modern_smartphones/datasets/raise/./extract_noise.py", line 114, in treatImage
    estimatedPrnuIterativeMean.add(imageNoiseNpArray)
  File "/home/benjamin/robust_image_source_identification_on_modern_smartphones/datasets/raise/utils.py", line 34, in add
    self.mean = ((self.mean * self.numberOfElementsInMean) + element) / (self.numberOfElementsInMean + 1)
                  ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
TypeError: unsupported operand type(s) for *: 'NoneType' and 'int'
```
2024-04-27 15:58:29 +02:00
bd0b9aca94
Correct support for JPG images 2024-04-27 15:55:25 +02:00
e9038bdb76
Hide inappropriate figure title 2024-04-27 15:21:57 +02:00
af947dbf65
Add articles/Euclidean distance - Wikipedia/ 2024-04-27 15:08:56 +02:00
5baabae99d
Make mean initialization more general in iterativeMean 2024-04-26 15:56:10 +02:00
1ea1bde910
Leverage iterativeMean in extract_noise.py 2024-04-26 14:25:08 +02:00
674f87d480
Remove unnecessary iterativeMean parentheses and rename addElement to add 2024-04-26 14:22:59 +02:00
7af96d6bf6
Add iterativeMean to utils
Verified with:

```py
myIterativeMean = iterativeMean()
print(myIterativeMean.mean)
myIterativeMean.addElement(2)
print(myIterativeMean.mean)
myIterativeMean.addElement(3)
print(myIterativeMean.mean)
```

Note that cannot simplify as follows in the general case of using images as
`element`s for instance:

```diff
diff --git a/datasets/raise/utils.py b/datasets/raise/utils.py
index fba5523..a116edb 100644
--- a/datasets/raise/utils.py
+++ b/datasets/raise/utils.py
@@ -27,12 +27,9 @@ def denoise(imageNpArray, denoiserName):
     return imageDenoisedNpArray

 class iterativeMean():
-    mean = None
+    mean = 0
     numberOfElementsInMean = 0

     def addElement(self, element):
-        if self.mean is None:
-            self.mean = element
-        else:
-            self.mean = ((self.mean * self.numberOfElementsInMean) + element) / (self.numberOfElementsInMean + 1)
+        self.mean = ((self.mean * self.numberOfElementsInMean) + element) / (self.numberOfElementsInMean + 1)
         self.numberOfElementsInMean += 1
\ No newline at end of file
```
2024-04-26 14:16:35 +02:00
7684e1408d
Remove unused imports in split_and_compare_prnus_of_subgroups.py 2024-04-26 13:58:19 +02:00
9c469cf67a
Leverage utils.py denoise in split_and_compare_prnus_of_subgroups.py 2024-04-26 13:58:00 +02:00
9d2903af60
Move denoise from extract_noise.py to utils.py
See next commit leveraging it in `split_and_compare_prnus_of_subgroups.py`
2024-04-26 13:57:18 +02:00
6a93b04686
Remove already used previous temporary analysis commit code 2024-04-26 13:49:31 +02:00
b52fff9deb
Add commented code to enforce merging Numpy arrays with a greyscale
colormap.
2024-04-26 13:48:44 +02:00
3ffcd33efe
Add Gaussian filter to blur images when using mean as denoiser
See
https://docs.scipy.org/doc/scipy-1.13.0/reference/generated/scipy.ndimage.gaussian_filter.html#ba1e4df0-d4be-47c2-81e5-059286837a2b.
2024-04-26 04:39:06 +02:00
9641641b61
Remove commented code from analyze_bayer_filter_mean_denoiser.py 2024-04-26 04:13:08 +02:00
3e8b607b97
Add analyze_bayer_filter_mean_denoiser.py 2024-04-26 04:12:13 +02:00
f1cafc1eb1
Improve yticks of boxplot in flat-field_pointer.py 2024-04-26 04:10:41 +02:00
25b3b30634
Remove a commented print in plot_dates.py 2024-04-26 04:10:02 +02:00
3ada720db9
Add execution results, plot of locations and distance analysis 2024-04-26 03:05:17 +02:00
56037b058b
Add Zoom to rectangle by default 2024-04-26 01:49:57 +02:00
f5c235c3cd
Add support to TIF for RAISE flat-field 2024-04-26 01:49:13 +02:00
ab72da470e
Ready for pointing 2024-04-26 01:34:55 +02:00
981e2a48ae
Add flat-field_pointer.py
https://matplotlib.org/3.8.4/gallery/event_handling/coords_demo.html
2024-04-26 01:21:20 +02:00
1e8d9d844c
Make plot_dates.py leverage photo exifs 2024-04-26 00:52:52 +02:00
7cfe566290
Add plot_dates.py as it is as a Matplotlib example
https://matplotlib.org/3.8.0/gallery/lines_bars_and_markers/timeline.html
2024-04-26 00:51:12 +02:00
719bb487dd
Restore other than raw images support 2024-04-25 18:12:36 +02:00
f88b6ec1a9
Save mean of each color channel to merge them into a single image being
the mean of images

Otherwise for each color channel could use:

```py
plt.imsave(f'{fileName}.png', colorMean)
```
2024-04-25 16:00:23 +02:00
4907d0c0fb
Add and use saveNpArray 2024-04-25 15:59:26 +02:00
65708e4977
Correctly implement mean denoiser
Used to have:

```py
imageDenoisedNpArray = imageNpArray - means[color]
imageNoiseNpArray = imageNpArray - imageDenoisedNpArray
```

so:

```py
imageNoiseNpArray = means[color]
```

then we mean the mean...

While should have:

```py
imageDenoisedNpArray = means[color]
```
2024-04-25 15:58:24 +02:00
60a4f78fa6
Ease providing {min,max}Color 2024-04-25 15:30:23 +02:00
c642fa430e
Add commented code to crop image
It is commented as it does not seem to be finally what we are looking
for.
2024-04-25 14:37:08 +02:00