Registrations Closing Soon for DevOps Certification Training by CloudxLab | Registrations Closing in

  Enroll Now

Importing the Modules

Let us begin by importing the necessary modules, setting the seed to get reproducible results, and defining a function fixColor.


  • By default, a color image with Red, Green, and Blue channels will be read in reverse order; ie, Blue, Green, and Red by OpenCv.

    We could fix this issue by using cv2.COLOR_BGR2RGB transformation effect on the image.

    So, we shall define a function fixColor to return the RGB form of the given image.

  • cv2.cvtColor() method is used to convert an image from one color space to another.

  • cv2.COLOR_BGR2RGB returns image in RGB format, which was initially in BGR format as read by cv2.imread().

  • Import numpy as np.

     import << your code comes here >> as  << your code comes here >>
  • Set the numpy seed:

  • Import time.

    import << your code comes here >>
  • Import matplotlib.pyplot as plt.

    %matplotlib inline
    import << your code comes here >> as << your code comes here >>
  • Import cv2.

    import << your code comes here >>
    print("cv2 version:",cv2.__version__)
  • Define fixColor function which takes an image as the input argument ad returns the RGB format of the image. Pass cv2.COLOR_BGR2RGB as an input argument along with image to the cv2.cvtColor method.

    def fixColor(image):
        return(cv2.cvtColor(image, << your code comes here >>))

No hints are availble for this assesment

Answer is not availble for this assesment

Note - Having trouble with the assessment engine? Follow the steps listed here

Loading comments...