{
  "id": 39393,
  "title": "image pre-processing",
  "url": "/competitions/carvana-image-masking-challenge/discussion/39393",
  "author_name": "",
  "post_date": "2017-09-13T08:47:40.548828700Z",
  "votes": 6,
  "comment_count": 2,
  "views": 0,
  "content": "<p>here is opencv preprocessing. Note:</p>\n\n<ul>\n<li><p>it take a long time to make these results</p></li>\n<li><p>I am not sure if they are useful or not</p></li>\n</ul>\n\n<p>links:</p>\n\n<p><a href=\"http://docs.opencv.org/trunk/d7/d8f/tutorial_bioinspired_retina_illusion.html\">http://docs.opencv.org/trunk/d7/d8f/tutorial_bioinspired_retina_illusion.html</a></p>\n\n<p><a href=\"http://docs.opencv.org/trunk/d2/d94/bioinspired_retina.html\">http://docs.opencv.org/trunk/d2/d94/bioinspired_retina.html</a></p>\n\n<p><a href=\"https://pypkg.com/pypi/simretina/f/simretina/retina.py\">https://pypkg.com/pypi/simretina/f/simretina/retina.py</a></p>\n\n<pre><code>    img_file = CARVANA_DIR + '/images/%s/%s.jpg'%(folder,name)\n    image = cv2.imread(img_file) \n\n    retina = cv2.bioinspired.createRetina( inputSize = (width,height),)\n\n    retina.setupOPLandIPLParvoChannel(\n        1 , #para_dict[\"color_mode\"],\n        1 , #para_dict[\"normalise_output_parvo\"],\n        0.89 , #para_dict[\"photoreceptors_local_adaptation_sensitivity\"],\n        0.9 , #para_dict[\"photoreceptors_temporal_constant\"],\n        0.53 , #para_dict[\"photoreceptors_spatial_constant\"],\n        0.3 , #para_dict[\"horizontal_cells_gain\"],\n        0.5 , #para_dict[\"hcells_temporal_constant\"],\n        7 , #para_dict[\"hcells_spatial_constant\"],\n        0.89 , #para_dict[\"ganglion_cells_sensitivity\"]\n    )\n\n    retina.setupIPLMagnoChannel(\n        1 , #para_dict[\"normalise_output_magno\"],\n        0 , #para_dict[\"parasol_cells_beta\"],\n        0 , #para_dict[\"parasol_cells_tau\"],\n        7 , #para_dict[\"parasol_cells_k\"],\n        2 , #para_dict[\"amacrin_cells_temporal_cut_frequency\"],\n        0.95 , #para_dict[\"v0_compression_parameter\"],\n        0 ,    #para_dict[\"local_adapt_integration_tau\"],\n        7 ,    #para_dict[\"local_adapt_integration_k\"]\n    )\n\n    for i in range(20):\n       print (i)\n       retina.run(image)\n\n\n    retinaOut_parvo = retina.getParvo()\n    im_show('image', image,  resize=1)\n    im_show('retinaOut_parvo',  retinaOut_parvo,  resize=1)\n    cv2.waitKey(0)\n</code></pre>",
  "messages": [
    {
      "id": "220840",
      "postDate": "09/13/2017 08:47:40",
      "content": "<p>here is opencv preprocessing. Note:</p>\n\n<ul>\n<li><p>it take a long time to make these results</p></li>\n<li><p>I am not sure if they are useful or not</p></li>\n</ul>\n\n<p>links:</p>\n\n<p><a href=\"http://docs.opencv.org/trunk/d7/d8f/tutorial_bioinspired_retina_illusion.html\">http://docs.opencv.org/trunk/d7/d8f/tutorial_bioinspired_retina_illusion.html</a></p>\n\n<p><a href=\"http://docs.opencv.org/trunk/d2/d94/bioinspired_retina.html\">http://docs.opencv.org/trunk/d2/d94/bioinspired_retina.html</a></p>\n\n<p><a href=\"https://pypkg.com/pypi/simretina/f/simretina/retina.py\">https://pypkg.com/pypi/simretina/f/simretina/retina.py</a></p>\n\n<pre><code>    img_file = CARVANA_DIR + '/images/%s/%s.jpg'%(folder,name)\n    image = cv2.imread(img_file) \n\n    retina = cv2.bioinspired.createRetina( inputSize = (width,height),)\n\n    retina.setupOPLandIPLParvoChannel(\n        1 , #para_dict[\"color_mode\"],\n        1 , #para_dict[\"normalise_output_parvo\"],\n        0.89 , #para_dict[\"photoreceptors_local_adaptation_sensitivity\"],\n        0.9 , #para_dict[\"photoreceptors_temporal_constant\"],\n        0.53 , #para_dict[\"photoreceptors_spatial_constant\"],\n        0.3 , #para_dict[\"horizontal_cells_gain\"],\n        0.5 , #para_dict[\"hcells_temporal_constant\"],\n        7 , #para_dict[\"hcells_spatial_constant\"],\n        0.89 , #para_dict[\"ganglion_cells_sensitivity\"]\n    )\n\n    retina.setupIPLMagnoChannel(\n        1 , #para_dict[\"normalise_output_magno\"],\n        0 , #para_dict[\"parasol_cells_beta\"],\n        0 , #para_dict[\"parasol_cells_tau\"],\n        7 , #para_dict[\"parasol_cells_k\"],\n        2 , #para_dict[\"amacrin_cells_temporal_cut_frequency\"],\n        0.95 , #para_dict[\"v0_compression_parameter\"],\n        0 ,    #para_dict[\"local_adapt_integration_tau\"],\n        7 ,    #para_dict[\"local_adapt_integration_k\"]\n    )\n\n    for i in range(20):\n       print (i)\n       retina.run(image)\n\n\n    retinaOut_parvo = retina.getParvo()\n    im_show('image', image,  resize=1)\n    im_show('retinaOut_parvo',  retinaOut_parvo,  resize=1)\n    cv2.waitKey(0)\n</code></pre>",
      "rawMarkdown": "here is opencv preprocessing. Note:\n\n - it take a long time to make these results\n\n - I am not sure if they are useful or not\n\nlinks:\n\nhttp://docs.opencv.org/trunk/d7/d8f/tutorial_bioinspired_retina_illusion.html\n\nhttp://docs.opencv.org/trunk/d2/d94/bioinspired_retina.html\n\nhttps://pypkg.com/pypi/simretina/f/simretina/retina.py\n\n        img_file = CARVANA_DIR + '/images/%s/%s.jpg'%(folder,name)\n        image = cv2.imread(img_file) \n\n        retina = cv2.bioinspired.createRetina( inputSize = (width,height),)\n\n        retina.setupOPLandIPLParvoChannel(\n            1 , #para_dict[\"color_mode\"],\n            1 , #para_dict[\"normalise_output_parvo\"],\n            0.89 , #para_dict[\"photoreceptors_local_adaptation_sensitivity\"],\n            0.9 , #para_dict[\"photoreceptors_temporal_constant\"],\n            0.53 , #para_dict[\"photoreceptors_spatial_constant\"],\n            0.3 , #para_dict[\"horizontal_cells_gain\"],\n            0.5 , #para_dict[\"hcells_temporal_constant\"],\n            7 , #para_dict[\"hcells_spatial_constant\"],\n            0.89 , #para_dict[\"ganglion_cells_sensitivity\"]\n        )\n\n        retina.setupIPLMagnoChannel(\n            1 , #para_dict[\"normalise_output_magno\"],\n            0 , #para_dict[\"parasol_cells_beta\"],\n            0 , #para_dict[\"parasol_cells_tau\"],\n            7 , #para_dict[\"parasol_cells_k\"],\n            2 , #para_dict[\"amacrin_cells_temporal_cut_frequency\"],\n            0.95 , #para_dict[\"v0_compression_parameter\"],\n            0 ,    #para_dict[\"local_adapt_integration_tau\"],\n            7 ,    #para_dict[\"local_adapt_integration_k\"]\n        )\n\n        for i in range(20):\n           print (i)\n           retina.run(image)\n\n\n        retinaOut_parvo = retina.getParvo()\n        im_show('image', image,  resize=1)\n        im_show('retinaOut_parvo',  retinaOut_parvo,  resize=1)\n        cv2.waitKey(0)",
      "votes": null
    },
    {
      "id": "220842",
      "postDate": "09/13/2017 08:49:46",
      "content": "<p>this compares the gradient orientation images of the hq and old images.</p>\n\n<pre><code>def draw_hsv(flow):\n   h, w = flow.shape[:2]\n   fx, fy = flow[:,:,0], flow[:,:,1]\n   ang = np.arctan2(fy, fx) + np.pi\n   v = np.sqrt(fx*fx+fy*fy)\n   hsv = np.zeros((h, w, 3), np.uint8)\n   hsv[...,0] = ang*(180/np.pi/2)\n   hsv[...,1] = 255\n   hsv[...,2] = np.minimum(v*4, 255)\n   bgr = cv2.cvtColor(hsv, cv2.COLOR_HSV2BGR)\nreturn bgr\n\ndef run_check_flow():\n\n   folder ='test_hq1024x1024'\n   #folder ='test512x512'\n   #folder ='test'\n   #folder ='test_hq'\n   #name = 'a67333bd4065_09'  #'0c56c040a690_09'\n   name = '1b218148cb02_09'  #'0c56c040a690_09'\n\n   img_file = CARVANA_DIR + '/images/%s/%s.jpg'%(folder,name)\n   image = cv2.imread(img_file)\n\n   gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)\n   height,width,C = image.shape\n   dx =np.zeros((height,width,1),np.float32)\n   dy =np.zeros((height,width,1),np.float32)\n\n   dx[:,1:,0] = gray[:,1:]-gray[:,:-1]\n   dy[1:,:,0] = gray[1:]-gray[:-1]\n\n   flow = np.dstack((dx,dy))\n\n   f = draw_hsv(flow)\n   cv2.imwrite('/root/share/project/kaggle-carvana-cars/results/processing/test_hq.png',f)\n   im_show('flow',  f,  resize=1)\n   im_show('dx',  np.abs(dx),  resize=1)\n   im_show('dy',  np.abs(dy),  resize=1)\n   cv2.waitKey(0)\n</code></pre>",
      "rawMarkdown": "this compares the gradient orientation images of the hq and old images.\n\n\n    def draw_hsv(flow):\n       h, w = flow.shape[:2]\n       fx, fy = flow[:,:,0], flow[:,:,1]\n       ang = np.arctan2(fy, fx) + np.pi\n       v = np.sqrt(fx*fx+fy*fy)\n       hsv = np.zeros((h, w, 3), np.uint8)\n       hsv[...,0] = ang*(180/np.pi/2)\n       hsv[...,1] = 255\n       hsv[...,2] = np.minimum(v*4, 255)\n       bgr = cv2.cvtColor(hsv, cv2.COLOR_HSV2BGR)\n    return bgr\n\n    def run_check_flow():\n\n       folder ='test_hq1024x1024'\n       #folder ='test512x512'\n       #folder ='test'\n       #folder ='test_hq'\n       #name = 'a67333bd4065_09'  #'0c56c040a690_09'\n       name = '1b218148cb02_09'  #'0c56c040a690_09'\n\n       img_file = CARVANA_DIR + '/images/%s/%s.jpg'%(folder,name)\n       image = cv2.imread(img_file)\n\n       gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)\n       height,width,C = image.shape\n       dx =np.zeros((height,width,1),np.float32)\n       dy =np.zeros((height,width,1),np.float32)\n\n       dx[:,1:,0] = gray[:,1:]-gray[:,:-1]\n       dy[1:,:,0] = gray[1:]-gray[:-1]\n\n       flow = np.dstack((dx,dy))\n\n       f = draw_hsv(flow)\n       cv2.imwrite('/root/share/project/kaggle-carvana-cars/results/processing/test_hq.png',f)\n       im_show('flow',  f,  resize=1)\n       im_show('dx',  np.abs(dx),  resize=1)\n       im_show('dy',  np.abs(dy),  resize=1)\n       cv2.waitKey(0)",
      "votes": null
    },
    {
      "id": "220873",
      "postDate": "09/13/2017 10:59:18",
      "content": "<p>I did a similar thing using histogram equalization. It helped with convergence speed but did not increase overall accuracy in a noticeable way.</p>\n\n<pre><code>import cv2\nimport os\nfrom scipy import ndimage\nimport matplotlib\nmatplotlib.use('TkAgg')\nfrom matplotlib import pyplot as plt\nimport numpy as np\n\ndef equalize(image_path, output_folder, testing=False):\n    if not testing:\n        new_clean_name = os.path.join(output_folder, os.path.basename(image_path))\n\n        if os.path.exists(new_clean_name):\n            return\n\n    #-----Reading the image-----------------------------------------------------\n    img = cv2.imread(image_path, 1)\n\n    #-----Converting image to LAB Color model----------------------------------- \n    lab= cv2.cvtColor(img, cv2.COLOR_BGR2LAB)\n    # cv2.imshow(\"lab\",lab)\n\n    #-----Splitting the LAB image to different channels-------------------------\n    l, a, b = cv2.split(lab)\n\n    #-----Applying CLAHE to L-channel-------------------------------------------\n    clahe = cv2.createCLAHE(clipLimit=6.0, tileGridSize=(64,64))\n    cl = clahe.apply(l)\n\n    #-----Merge the CLAHE enhanced L-channel with the a and b channel-----------\n    limg = cv2.merge((cl,a,b))\n\n    #-----Converting image from LAB Color model to RGB model--------------------\n    final = cv2.cvtColor(limg, cv2.COLOR_LAB2BGR)\n\n    # cv2.imshow('final', final)\n    # cv2.imwrite(new_edge_name, final_edges)\n    if not testing:\n        cv2.imwrite(new_clean_name, final)\n    else:\n        plt.imshow(cv2.cvtColor(limg, cv2.COLOR_LAB2RGB))\n        plt.show()\n</code></pre>",
      "rawMarkdown": "I did a similar thing using histogram equalization. It helped with convergence speed but did not increase overall accuracy in a noticeable way.\n\n    import cv2\n    import os\n    from scipy import ndimage\n    import matplotlib\n    matplotlib.use('TkAgg')\n    from matplotlib import pyplot as plt\n    import numpy as np\n    \n    def equalize(image_path, output_folder, testing=False):\n        if not testing:\n            new_clean_name = os.path.join(output_folder, os.path.basename(image_path))\n    \n            if os.path.exists(new_clean_name):\n                return\n    \n        #-----Reading the image-----------------------------------------------------\n        img = cv2.imread(image_path, 1)\n    \n        #-----Converting image to LAB Color model----------------------------------- \n        lab= cv2.cvtColor(img, cv2.COLOR_BGR2LAB)\n        # cv2.imshow(\"lab\",lab)\n    \n        #-----Splitting the LAB image to different channels-------------------------\n        l, a, b = cv2.split(lab)\n    \n        #-----Applying CLAHE to L-channel-------------------------------------------\n        clahe = cv2.createCLAHE(clipLimit=6.0, tileGridSize=(64,64))\n        cl = clahe.apply(l)\n    \n        #-----Merge the CLAHE enhanced L-channel with the a and b channel-----------\n        limg = cv2.merge((cl,a,b))\n    \n        #-----Converting image from LAB Color model to RGB model--------------------\n        final = cv2.cvtColor(limg, cv2.COLOR_LAB2BGR)\n        \n        # cv2.imshow('final', final)\n        # cv2.imwrite(new_edge_name, final_edges)\n        if not testing:\n            cv2.imwrite(new_clean_name, final)\n        else:\n            plt.imshow(cv2.cvtColor(limg, cv2.COLOR_LAB2RGB))\n            plt.show()",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 220842,
      "author_name": "hengck23",
      "author_url": "",
      "post_date": "09/13/2017 08:49:46",
      "content": "<p>this compares the gradient orientation images of the hq and old images.</p>\n\n<pre><code>def draw_hsv(flow):\n   h, w = flow.shape[:2]\n   fx, fy = flow[:,:,0], flow[:,:,1]\n   ang = np.arctan2(fy, fx) + np.pi\n   v = np.sqrt(fx*fx+fy*fy)\n   hsv = np.zeros((h, w, 3), np.uint8)\n   hsv[...,0] = ang*(180/np.pi/2)\n   hsv[...,1] = 255\n   hsv[...,2] = np.minimum(v*4, 255)\n   bgr = cv2.cvtColor(hsv, cv2.COLOR_HSV2BGR)\nreturn bgr\n\ndef run_check_flow():\n\n   folder ='test_hq1024x1024'\n   #folder ='test512x512'\n   #folder ='test'\n   #folder ='test_hq'\n   #name = 'a67333bd4065_09'  #'0c56c040a690_09'\n   name = '1b218148cb02_09'  #'0c56c040a690_09'\n\n   img_file = CARVANA_DIR + '/images/%s/%s.jpg'%(folder,name)\n   image = cv2.imread(img_file)\n\n   gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)\n   height,width,C = image.shape\n   dx =np.zeros((height,width,1),np.float32)\n   dy =np.zeros((height,width,1),np.float32)\n\n   dx[:,1:,0] = gray[:,1:]-gray[:,:-1]\n   dy[1:,:,0] = gray[1:]-gray[:-1]\n\n   flow = np.dstack((dx,dy))\n\n   f = draw_hsv(flow)\n   cv2.imwrite('/root/share/project/kaggle-carvana-cars/results/processing/test_hq.png',f)\n   im_show('flow',  f,  resize=1)\n   im_show('dx',  np.abs(dx),  resize=1)\n   im_show('dy',  np.abs(dy),  resize=1)\n   cv2.waitKey(0)\n</code></pre>",
      "votes": null,
      "replies": []
    },
    {
      "id": 220873,
      "author_name": "adamhart",
      "author_url": "",
      "post_date": "09/13/2017 10:59:18",
      "content": "<p>I did a similar thing using histogram equalization. It helped with convergence speed but did not increase overall accuracy in a noticeable way.</p>\n\n<pre><code>import cv2\nimport os\nfrom scipy import ndimage\nimport matplotlib\nmatplotlib.use('TkAgg')\nfrom matplotlib import pyplot as plt\nimport numpy as np\n\ndef equalize(image_path, output_folder, testing=False):\n    if not testing:\n        new_clean_name = os.path.join(output_folder, os.path.basename(image_path))\n\n        if os.path.exists(new_clean_name):\n            return\n\n    #-----Reading the image-----------------------------------------------------\n    img = cv2.imread(image_path, 1)\n\n    #-----Converting image to LAB Color model----------------------------------- \n    lab= cv2.cvtColor(img, cv2.COLOR_BGR2LAB)\n    # cv2.imshow(\"lab\",lab)\n\n    #-----Splitting the LAB image to different channels-------------------------\n    l, a, b = cv2.split(lab)\n\n    #-----Applying CLAHE to L-channel-------------------------------------------\n    clahe = cv2.createCLAHE(clipLimit=6.0, tileGridSize=(64,64))\n    cl = clahe.apply(l)\n\n    #-----Merge the CLAHE enhanced L-channel with the a and b channel-----------\n    limg = cv2.merge((cl,a,b))\n\n    #-----Converting image from LAB Color model to RGB model--------------------\n    final = cv2.cvtColor(limg, cv2.COLOR_LAB2BGR)\n\n    # cv2.imshow('final', final)\n    # cv2.imwrite(new_edge_name, final_edges)\n    if not testing:\n        cv2.imwrite(new_clean_name, final)\n    else:\n        plt.imshow(cv2.cvtColor(limg, cv2.COLOR_LAB2RGB))\n        plt.show()\n</code></pre>",
      "votes": null,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "220840": "here is opencv preprocessing. Note:\n\n - it take a long time to make these results\n\n - I am not sure if they are useful or not\n\nlinks:\n\nhttp://docs.opencv.org/trunk/d7/d8f/tutorial_bioinspired_retina_illusion.html\n\nhttp://docs.opencv.org/trunk/d2/d94/bioinspired_retina.html\n\nhttps://pypkg.com/pypi/simretina/f/simretina/retina.py\n\n        img_file = CARVANA_DIR + '/images/%s/%s.jpg'%(folder,name)\n        image = cv2.imread(img_file) \n\n        retina = cv2.bioinspired.createRetina( inputSize = (width,height),)\n\n        retina.setupOPLandIPLParvoChannel(\n            1 , #para_dict[\"color_mode\"],\n            1 , #para_dict[\"normalise_output_parvo\"],\n            0.89 , #para_dict[\"photoreceptors_local_adaptation_sensitivity\"],\n            0.9 , #para_dict[\"photoreceptors_temporal_constant\"],\n            0.53 , #para_dict[\"photoreceptors_spatial_constant\"],\n            0.3 , #para_dict[\"horizontal_cells_gain\"],\n            0.5 , #para_dict[\"hcells_temporal_constant\"],\n            7 , #para_dict[\"hcells_spatial_constant\"],\n            0.89 , #para_dict[\"ganglion_cells_sensitivity\"]\n        )\n\n        retina.setupIPLMagnoChannel(\n            1 , #para_dict[\"normalise_output_magno\"],\n            0 , #para_dict[\"parasol_cells_beta\"],\n            0 , #para_dict[\"parasol_cells_tau\"],\n            7 , #para_dict[\"parasol_cells_k\"],\n            2 , #para_dict[\"amacrin_cells_temporal_cut_frequency\"],\n            0.95 , #para_dict[\"v0_compression_parameter\"],\n            0 ,    #para_dict[\"local_adapt_integration_tau\"],\n            7 ,    #para_dict[\"local_adapt_integration_k\"]\n        )\n\n        for i in range(20):\n           print (i)\n           retina.run(image)\n\n\n        retinaOut_parvo = retina.getParvo()\n        im_show('image', image,  resize=1)\n        im_show('retinaOut_parvo',  retinaOut_parvo,  resize=1)\n        cv2.waitKey(0)",
    "220842": "this compares the gradient orientation images of the hq and old images.\n\n\n    def draw_hsv(flow):\n       h, w = flow.shape[:2]\n       fx, fy = flow[:,:,0], flow[:,:,1]\n       ang = np.arctan2(fy, fx) + np.pi\n       v = np.sqrt(fx*fx+fy*fy)\n       hsv = np.zeros((h, w, 3), np.uint8)\n       hsv[...,0] = ang*(180/np.pi/2)\n       hsv[...,1] = 255\n       hsv[...,2] = np.minimum(v*4, 255)\n       bgr = cv2.cvtColor(hsv, cv2.COLOR_HSV2BGR)\n    return bgr\n\n    def run_check_flow():\n\n       folder ='test_hq1024x1024'\n       #folder ='test512x512'\n       #folder ='test'\n       #folder ='test_hq'\n       #name = 'a67333bd4065_09'  #'0c56c040a690_09'\n       name = '1b218148cb02_09'  #'0c56c040a690_09'\n\n       img_file = CARVANA_DIR + '/images/%s/%s.jpg'%(folder,name)\n       image = cv2.imread(img_file)\n\n       gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)\n       height,width,C = image.shape\n       dx =np.zeros((height,width,1),np.float32)\n       dy =np.zeros((height,width,1),np.float32)\n\n       dx[:,1:,0] = gray[:,1:]-gray[:,:-1]\n       dy[1:,:,0] = gray[1:]-gray[:-1]\n\n       flow = np.dstack((dx,dy))\n\n       f = draw_hsv(flow)\n       cv2.imwrite('/root/share/project/kaggle-carvana-cars/results/processing/test_hq.png',f)\n       im_show('flow',  f,  resize=1)\n       im_show('dx',  np.abs(dx),  resize=1)\n       im_show('dy',  np.abs(dy),  resize=1)\n       cv2.waitKey(0)",
    "220873": "I did a similar thing using histogram equalization. It helped with convergence speed but did not increase overall accuracy in a noticeable way.\n\n    import cv2\n    import os\n    from scipy import ndimage\n    import matplotlib\n    matplotlib.use('TkAgg')\n    from matplotlib import pyplot as plt\n    import numpy as np\n    \n    def equalize(image_path, output_folder, testing=False):\n        if not testing:\n            new_clean_name = os.path.join(output_folder, os.path.basename(image_path))\n    \n            if os.path.exists(new_clean_name):\n                return\n    \n        #-----Reading the image-----------------------------------------------------\n        img = cv2.imread(image_path, 1)\n    \n        #-----Converting image to LAB Color model----------------------------------- \n        lab= cv2.cvtColor(img, cv2.COLOR_BGR2LAB)\n        # cv2.imshow(\"lab\",lab)\n    \n        #-----Splitting the LAB image to different channels-------------------------\n        l, a, b = cv2.split(lab)\n    \n        #-----Applying CLAHE to L-channel-------------------------------------------\n        clahe = cv2.createCLAHE(clipLimit=6.0, tileGridSize=(64,64))\n        cl = clahe.apply(l)\n    \n        #-----Merge the CLAHE enhanced L-channel with the a and b channel-----------\n        limg = cv2.merge((cl,a,b))\n    \n        #-----Converting image from LAB Color model to RGB model--------------------\n        final = cv2.cvtColor(limg, cv2.COLOR_LAB2BGR)\n        \n        # cv2.imshow('final', final)\n        # cv2.imwrite(new_edge_name, final_edges)\n        if not testing:\n            cv2.imwrite(new_clean_name, final)\n        else:\n            plt.imshow(cv2.cvtColor(limg, cv2.COLOR_LAB2RGB))\n            plt.show()"
  },
  "source": "meta"
}