我剪掉了部分图像,并通过 12 个轨迹栏定义了 2 个颜色范围 (H/S/L)。我还有一个“精度/速度”滑块,范围从 1 到 10。
我需要分析图像的多少像素属于每个指定的颜色范围。
根据精度/速度滑块,我跳过一些行/像素。
它工作得很好,但太慢了。高精度(轨迹条值 = 1)时,大约需要 550 ms。
精度低但速度快(轨迹条值 = 10),大约需要 5 毫秒。
有没有办法加快这段代码的速度?理想情况下我需要它快 5 倍。
For y As Integer = 0 To 395
If y Mod 2 = 0 Then
startpixel = tbval / 2
Else
startpixel = 0
End If
If y Mod tbval = 0 Then
For x As Integer = 0 To 1370
If x Mod tbval - startpixel = 0 Then
analyzedpixels = analyzedpixels + 1
Dim …Run Code Online (Sandbox Code Playgroud) 目前,我有这个代码.
Dim iCurrentDate As Date = Now
Dim iStartDate As Date = CDate(dtFrom.Text)
Dim iEndDate As Date = CDate(dtTo.Text)
If (iCurrentDate > iStartDate) And (iCurrentDate < iEndDate) Then
Console.WriteLine("Current date is within the range.")
'Other Codes here
Else
Console.WriteLine("Current date is in the range.")
'Other Codes here
End If
Run Code Online (Sandbox Code Playgroud)
要么
Dim iObj As Object = IIf((iCurrentDate > iStartDate) And (iCurrentDate < iEndDate), "Current date is within the range.", "Current date is in the range.")
Console.WriteLine(iObj.ToString)
'Other Codes here
Run Code Online (Sandbox Code Playgroud)
上面的代码有替代品吗?就像BETWEEN …