Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6016001
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T02:55:14+00:00 2026-05-23T02:55:14+00:00

I am trying to write a function in Matlab that takes an RGB image

  • 0

I am trying to write a function in Matlab that takes an RGB image of class unit8 and double and converts it to a YCBCR image. The transformation formula is below.

The transformation between YCbCr and RGB

I would be really thankful for any help of any kind.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T02:55:15+00:00Added an answer on May 23, 2026 at 2:55 am

    There’s an Image Processing Toolbox function for that, if you have access to it: RGB2YCBCR

    If you don’t have access to it, here’s how you can do the conversion yourself:

    rgbImage = imread('peppers.png');  %# A sample RGB image
    A = [65.481 -37.797 112; ...       %# A 3-by-3 matrix of scale factors
         128.553 -74.203 -93.786; ...
         24.966 112 -18.214];
    
    %# First convert the RGB image to double precision, scale its values to the
    %#   range 0 to 1, reshape it to an N-by-3 matrix, and multiply by A:
    ycbcrImage = reshape(double(rgbImage)./255,[],3)*A;
    
    %# Shift each color plane (stored in each column of the N-by-3 matrix):
    ycbcrImage(:,1) = ycbcrImage(:,1)+16;
    ycbcrImage(:,2) = ycbcrImage(:,2)+128;
    ycbcrImage(:,3) = ycbcrImage(:,3)+128;
    
    %# Convert back to type uint8 and reshape to its original size:
    ycbcrImage = reshape(uint8(ycbcrImage),size(rgbImage));
    

    And here’s the image you get when you display ycbcrImage:

    enter image description here

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to write a simple function that takes two inputs, x and y
I'm trying to write a function for a database class that is basically just
I'm trying to write a function that formats every (string) member/variable in an object,
I am trying to write a function that will pull the name of a
I'm trying to write a function that is able to determine whether a string
I'm trying to write a regex function that will identify and replace a single
I am trying to write a JavaScript function that will return its first argument(function)
I'm trying to write a custom function that will let me retrieve a cell
I am trying to write my first real python function that does something real.
I'm trying to find/write a function that would perform the same operation as imlincomb

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.