title: efficient way to change BGR to grayscale image and then use LUT
body: <p>I have got a BGR image and I am trying to map a lookup table based on its intensity. It works and I do it the following way:</p>
  
  <pre><code>cv::cvtColor(original_frame, gray_frame, cv::COLOR_BGR2GRAY);
  cv::cvtColor(gray_frame, gray_frame3,cv::COLOR_GRAY2BGR);
  LUT(gray_frame3, mylut, pcolor_frame);
  </code></pre>
  
  <p>This seems very inefficient to me. At first I change the original BGR to a single-channel grayscale which I then expand into 3 channels to use with LUT.</p>
  
  <p>Can I somehow improve speed by </p>
  
  <ul>
  <li>directly converting the original image into a 3-channel grayscale image or </li>
  <li>by using a single-channel grayscale image to map to the look-up table?</li>
  </ul>