<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic cv2.error: ScannedMapDigitizer in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/cv2-error-scannedmapdigitizer/m-p/1164512#M64343</link>
    <description>&lt;P&gt;I'm trying to repeat the code from&amp;nbsp;&lt;A href="https://developers.arcgis.com/python/guide/geo-referencing-and-digitization-of-scanned-maps/" target="_blank" rel="noopener"&gt; https://developers.arcgis.com/python/guide/geo-referencing-and-digitization-of-scanned-maps/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from arcgis.learn import ScannedMapDigitizer

smd = ScannedMapDigitizer(r"D:\Arcgis\TEST\RASTER", r"D:\Arcgis\TEST\RASTER\OUT")
smd.create_mask(color_list=[[115, 178, 115]], color_delta=10, kernel_size=[3, 3], kernel_type="rect", show_result=False)
smd.create_template_image([100, 100,100], 10, 4, show_result= False)
extent = {
'spatialReference': {'wkid': 4326},
'xmin': -180,
'ymin': -89,
'xmax': 180,
'ymax': 85
}

smd.set_search_region_extent(extent)
ssearch_extent = {
'spatialReference': {'wkid': 4326},
'xmin': -180,
'ymin': -89,
'xmax': 180,
'ymax': 85
}
smd.prepare_search_region(r"D:\Arcgis\cover2_admin_M1-1.0\cover2_admin_M1-1.0.shp", [255, 255, 255], search_extent, 2068, 3744, show_result=True)
smd.match_template_multiscale(0.2, 2.0, 40, show_result=False)
smd.georeference_image((150, 50), show_result=False)
smd.digitize_image(show_result=False)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The script throws an error&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Traceback (most recent call last):&lt;BR /&gt;File "D:\Arcgis\SCRIPT\LEARN.py", line 4, in &amp;lt;module&amp;gt;&lt;BR /&gt;smd.create_mask(color_list=[[115, 178, 115]], color_delta=10, kernel_size=[3, 3], kernel_type="rect", show_result=False)&lt;BR /&gt;File "C:\Users\WF\AppData\Local\Programs\Python\Python39\lib\site-packages\arcgis\learn\_scannedmapdigitizer.py", line 1763, in create_mask&lt;BR /&gt;rgb_img = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)&lt;BR /&gt;cv2.error: OpenCV(4.5.5) D:\a\opencv-python\opencv-python\opencv\modules\imgproc\src\color.cpp:182: error: (-215:Assertion failed) !_src.empty() in function 'cv::cvtColor'&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Tell me where I went wrong ???&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 15 Apr 2022 06:51:10 GMT</pubDate>
    <dc:creator>Sergey_Grechkin</dc:creator>
    <dc:date>2022-04-15T06:51:10Z</dc:date>
    <item>
      <title>cv2.error: ScannedMapDigitizer</title>
      <link>https://community.esri.com/t5/python-questions/cv2-error-scannedmapdigitizer/m-p/1164512#M64343</link>
      <description>&lt;P&gt;I'm trying to repeat the code from&amp;nbsp;&lt;A href="https://developers.arcgis.com/python/guide/geo-referencing-and-digitization-of-scanned-maps/" target="_blank" rel="noopener"&gt; https://developers.arcgis.com/python/guide/geo-referencing-and-digitization-of-scanned-maps/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from arcgis.learn import ScannedMapDigitizer

smd = ScannedMapDigitizer(r"D:\Arcgis\TEST\RASTER", r"D:\Arcgis\TEST\RASTER\OUT")
smd.create_mask(color_list=[[115, 178, 115]], color_delta=10, kernel_size=[3, 3], kernel_type="rect", show_result=False)
smd.create_template_image([100, 100,100], 10, 4, show_result= False)
extent = {
'spatialReference': {'wkid': 4326},
'xmin': -180,
'ymin': -89,
'xmax': 180,
'ymax': 85
}

smd.set_search_region_extent(extent)
ssearch_extent = {
'spatialReference': {'wkid': 4326},
'xmin': -180,
'ymin': -89,
'xmax': 180,
'ymax': 85
}
smd.prepare_search_region(r"D:\Arcgis\cover2_admin_M1-1.0\cover2_admin_M1-1.0.shp", [255, 255, 255], search_extent, 2068, 3744, show_result=True)
smd.match_template_multiscale(0.2, 2.0, 40, show_result=False)
smd.georeference_image((150, 50), show_result=False)
smd.digitize_image(show_result=False)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The script throws an error&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Traceback (most recent call last):&lt;BR /&gt;File "D:\Arcgis\SCRIPT\LEARN.py", line 4, in &amp;lt;module&amp;gt;&lt;BR /&gt;smd.create_mask(color_list=[[115, 178, 115]], color_delta=10, kernel_size=[3, 3], kernel_type="rect", show_result=False)&lt;BR /&gt;File "C:\Users\WF\AppData\Local\Programs\Python\Python39\lib\site-packages\arcgis\learn\_scannedmapdigitizer.py", line 1763, in create_mask&lt;BR /&gt;rgb_img = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)&lt;BR /&gt;cv2.error: OpenCV(4.5.5) D:\a\opencv-python\opencv-python\opencv\modules\imgproc\src\color.cpp:182: error: (-215:Assertion failed) !_src.empty() in function 'cv::cvtColor'&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Tell me where I went wrong ???&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 15 Apr 2022 06:51:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/cv2-error-scannedmapdigitizer/m-p/1164512#M64343</guid>
      <dc:creator>Sergey_Grechkin</dc:creator>
      <dc:date>2022-04-15T06:51:10Z</dc:date>
    </item>
    <item>
      <title>Re: cv2.error: ScannedMapDigitizer</title>
      <link>https://community.esri.com/t5/python-questions/cv2-error-scannedmapdigitizer/m-p/1167762#M64407</link>
      <description>&lt;P&gt;A little late to reply... but how are you running this code?&lt;BR /&gt;&lt;BR /&gt;That error looks like it's calling OpenCV from your D drive. Do you have OpenCV installed more than once on your computer (outside of ArcPro)?&lt;BR /&gt;&lt;BR /&gt;There are some notorious Python/Conda OpenCV installation and path conflict issues. Perhaps for some reason arcpy is seeing the wrong cv2.&lt;/P&gt;</description>
      <pubDate>Mon, 25 Apr 2022 23:25:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/cv2-error-scannedmapdigitizer/m-p/1167762#M64407</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2022-04-25T23:25:42Z</dc:date>
    </item>
  </channel>
</rss>

