好吧,我正在使用图像处理来识别图像的颜色变化并能够在直方图中绘制该数据。为此,我使用 RGB 颜色空间中的皮肤斑点图像。下面的代码我可以获取每个像素的颜色并使用 color.rgb2lab 转换为 HSV。但是由于我想转换为L*a*b*,因为它更接近人类视觉,所以在python库中没有转换为L*a*b*。有了这个,通过RGB的分离像素,我如何将这些像素转换为LAB颜色?
import numpy as np
import mpl_toolkits.mplot3d.axes3d as p3
import matplotlib.pyplot as plt
import colorsys
from PIL import Image
# (1) Import the file to be analyzed!
img_file = Image.open("IMD006.png")
img = img_file.load()
# (2) Get image width & height in pixels
[xs, ys] = img_file.size
max_intensity = 100
hues = {}
# (3) Examine each pixel in the image file
for x in xrange(0, xs):
for y in xrange(0, ys):
# (4) Get the …
Run Code Online (Sandbox Code Playgroud) 我正在处理皮肤图像,以识别皮肤上的瑕疵,并且由于存在噪音(主要是由于存在头发),这项工作变得更加复杂。
我有一个图像示例,在该示例中,我尝试仅突出显示皮肤斑点,但是由于头发过多,该算法无效。有了这个,我希望您能帮助我开发一种删除或减少头发数量的算法,以便我只能突出显示我感兴趣的区域(ROI)。
用于突出皮肤瑕疵的算法:
import numpy as np
import cv2
#Read the image and perform threshold
img = cv2.imread('IMD006.bmp')
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
blur = cv2.medianBlur(gray,5)
_,thresh = cv2.threshold(blur,0,255,cv2.THRESH_BINARY_INV+cv2.THRESH_OTSU)
#Search for contours and select the biggest one
contours, hierarchy = cv2.findContours(thresh,cv2.RETR_TREE,cv2.CHAIN_APPROX_NONE)
cnt = max(contours, key=cv2.contourArea)
#Create a new mask for the result image
h, w = img.shape[:2]
mask = np.zeros((h, w), np.uint8)
#Draw the contour on the new mask and perform the bitwise operation
cv2.drawContours(mask, [cnt],-1, 255, -1)
res = cv2.bitwise_and(img, …
Run Code Online (Sandbox Code Playgroud) 我正在开发一个项目,以识别某些斑点的颜色为起点,为此,我正在绘制带有这些图像RGB颜色的3D图形。由此,我确定了这些斑点的一些醒目的颜色,如下所示。
颜色是理解的主观性和解释性的问题。此步骤的目的是进行识别,以便您可以找到颜色的图案而不会造成差异。因此,我一直在互联网上搜索,为此,建议使用颜色空间L * a * b *。
有了这个,有人可以帮我获得带有LAB颜色的图表,还是指出另一种更好地对这些斑点的颜色进行分类的方法?
用于绘制3D图形的代码
import numpy as np
import mpl_toolkits.mplot3d.axes3d as p3
import matplotlib.pyplot as plt
import colorsys
from PIL import Image
# (1) Import the file to be analyzed!
img_file = Image.open("IMD405.png")
img = img_file.load()
# (2) Get image width & height in pixels
[xs, ys] = img_file.size
max_intensity = 100
hues = {}
# (3) Examine each pixel in the image file
for x in xrange(0, xs):
for y in xrange(0, …
Run Code Online (Sandbox Code Playgroud) 我正在开发一个通过电子邮件发送处理报告的应用程序。当在应用程序中完成处理数据时,用户会发送一封包含处理数据的电子邮件。但是,我在 Android 11 上遇到了问题。将报告附加到电子邮件时,无论电子邮件应用程序如何,都会出现一条消息:无法附加文件。我一直在研究,发现这可能与在 android 11 版本的设备上访问设备内部存储的权限有关。我希望我能帮助您发送带有 android 11 附加文件的电子邮件。
我的代码:清单
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:networkSecurityConfig="@xml/network_security_config"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme"
android:requestLegacyExternalStorage="true"
tools:ignore="AllowBackup"
tools:targetApi="n">
<activity.....
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.provider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/file_paths" />
</provider>
</application>
Run Code Online (Sandbox Code Playgroud)
我的xml:
<?xml version="1.0" encoding="utf-8"?>
<paths>
<external-path name="external_files" path="."/>
</paths>
Run Code Online (Sandbox Code Playgroud)
保存文件 .pdf
val mDocProc = Document()
val file =
File(
Environment.getExternalStorageDirectory()
.toString() + "/" + "Relatório diário" + date + ".pdf"
)
if (file.exists()) { …
Run Code Online (Sandbox Code Playgroud) 我将图片的颜色转换为 LAB,如下所示:
import cv2
imbgr=cv2.imread('photo.jpg')
imlab=cv2.cvtColor(imbgr,cv2.COLOR_BGR2LAB)
cv2.imwrite('lab.jpg',imlab)
Run Code Online (Sandbox Code Playgroud)
用 imlab [x, y] 返回像素,如何用这些值绘制图形?