使用派生的映射函数修改s?
我已经多次阅读了整篇论文,并且找到了一种使所有内容都在Python中制作的方法...除此之外(第二条第C条)。他们希望我以旧钟的2.589倍的2.589倍的新最小值和旧最大的0.9倍。我该如何实现?
编辑:感谢FMW42,我现在有一个大致执行应有的代码,但是当我使用DTW值“'tuple'对象没有属性'dtype'时,它会引发错误:
hsv_img = cv2.cvtColor(img, cv2.COLOR_BGR2HSV)
h, s, v = cv2.split(hsv_img)
clahe = cv2.createCLAHE(clipLimit=2.6, tileGridSize=(3,3))
clahe_v = clahe.apply(v)
dwts = pywt.dwt(s, 'bior1.3')
smin = np.amin(dwts)
smax = np.amax(dwts)
print("smin:", smin, "smax:", smax)
sleep(2)
smin_new = 2.589 * smin
smax_new = 0.9 * smax
print("smin_new:", smin_new, "smax_new:", smax_new)
sleep(2)
magic_s = skimage.exposure.rescale_intensity(dwts, in_range=(smin,smax), out_range=(smin_new,smax_new)).astype(np.uint8)
对Google链接btw:抱歉。 (( 文章链接:[https://www.google.com/url?sa = t& rct=j&p =&q =&p =& 2F%2FCore.AC.UK%2FDownload%2FPDF%2F2228552574.PDF& usg = aovvaw15wem7_gvgvgvmvzhmhntksn] [1]
I've read this entire paper multiple times, and I've found a way to make everything in python... Except this (Article II, section C). They want me to upscale the saturation values with a new min of 2.589 times the old min, and a new max of 0.9 times the old max. How do i achieve this?
Edit: Thanks to fmw42 i now have a code that roughly does what it should, but it throws an error when i use my dtw value "'tuple' object has no attribute 'dtype'" My code:
hsv_img = cv2.cvtColor(img, cv2.COLOR_BGR2HSV)
h, s, v = cv2.split(hsv_img)
clahe = cv2.createCLAHE(clipLimit=2.6, tileGridSize=(3,3))
clahe_v = clahe.apply(v)
dwts = pywt.dwt(s, 'bior1.3')
smin = np.amin(dwts)
smax = np.amax(dwts)
print("smin:", smin, "smax:", smax)
sleep(2)
smin_new = 2.589 * smin
smax_new = 0.9 * smax
print("smin_new:", smin_new, "smax_new:", smax_new)
sleep(2)
magic_s = skimage.exposure.rescale_intensity(dwts, in_range=(smin,smax), out_range=(smin_new,smax_new)).astype(np.uint8)
sorry for the google link btw :(
Article link: [https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=&ved=2ahUKEwjx2_Cay9z3AhWDyYsKHdeFCn8QFnoECAoQAQ&url=https%3A%2F%2Fcore.ac.uk%2Fdownload%2Fpdf%2F228552574.pdf&usg=AOvVaw15wEM7_gVgvmVZhmHNTksN][1]
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在Python/opencv/numpy/spimage中,您可以使用np.amin()和np.amax()获取图像中的最小值和最大值。然后,从“旧最小的2.589倍的2.589倍”中计算新的最小值,而新的最大最高为0.9倍旧的最大值”。然后,使用skimage.spure.Rescale_intsentys()进行从输入值到新输出值的处理。
这是一个示例,使用旧的最小值和0.5时间的5倍,以使更改更明显。
输入:
计算:
Smin:10 Smax:255
smin_new:50 smax_new:127.5
结果:
In Python/OpenCV/Numpy/Skimage, you can use np.amin() and np.amax() to get the min and max values in the image. Then compute the new min and max from your " 2.589 times the old min, and a new max of 0.9 times the old max" in Python simple math. Then use skimage.exposure.rescale_intensity() to do the processing from input values to new output values.
Here is an example using 5 times the old min and 0.5 time the old max so that the change is more visible.
Input:
Calculations:
smin: 10 smax: 255
smin_new: 50 smax_new: 127.5
Result: