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 5949649
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T17:16:48+00:00 2026-05-22T17:16:48+00:00

When halving chroma channels width and/or height, what’s the correct way to subsamble? To

  • 0

When halving chroma channels width and/or height, what’s the correct way to subsamble? To take one chroma pixel for each 2×2 luma pixel, when sampling from a full-resolution chroma source, which chroma pixel do we take – top left? Average of all 4? Doesn’t matter?

This is my current code

if field == 'top':
    i = 0
elif field == 'bottom':
    i = 1

U = fromstring(Udata, dtype='uint8', count=w/2*h).reshape(h,w/2)

# halve chroma height (it's already half-width from UYVY source) by line skipping
U = U[i::2]

# scale chroma by a factor of 0.5 (2x2 pixels in -> 1 pixel out)
U = (U[0::2, 0::2]>>2) + (U[0::2, 1::2]>>2) + (U[1::2, 0::2]>>2) + (U[1::2, 1::2]>>2) + \
  (((U[0::2, 0::2]%4)  + (U[0::2, 1::2]%4)  + (U[1::2, 0::2]%4)  + (U[1::2, 1::2]%4)) >> 2)
  • 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-22T17:16:49+00:00Added an answer on May 22, 2026 at 5:16 pm

    Ideally you would interpolate the data to produce the best possible image, however I think that your question is best answered with a quick overview of WHERE the luma and chroma samples are located (imagine a camera with one grid for luma and the other for chroma). For subsampling there are multiple standards for selecting the location of chroma relative to luma samples.

    most often the chroma is either co-located with the "top left" luma pixel,

    XO  X   XO  X
    
    X   X   X   X
     
    XO  X   XO  X
     
    X   X   X   X
    

    or is located in the center of the square,

    X   X   X   X
      O      O
    X   X   X   X
    
    X   X   X   X
      O      O
    X   X   X   X
    

    or is located on the left side of the square between the two left luma samples.

    X   X   X   X
    O       O
    X   X   X   X
    
    X   X   X   X
    O       O
    X   X   X   X
    

    notice that in all cases the chroma value co-located with at least some luma samples will be a combination of several chroma values, this is generally done with a FIR filter, which is why another filter is recommended for the reverse operation (however you can get OK results with averaging)

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

Sidebar

Related Questions

Having trouble with each function... Will try to explain by example... In my code,
I am working on android camera app,I want green screen chroma key effect to
It seems I am having a strange issue in Chrome, with width: 0px. I
I'm having trouble figuring out why inline elements ignore line-height in some browsers (Chrome
This is solved! Turns out the body tag didn't have a height as 100%
im trying to line up two divs next to each other. i managed to
I'm having a problem with overflow and width in Google Chrome/Webkit. This is a
In Chrome v17.0.963.79 on Windows 7, I seem to be having an inexplicable problem
I'm having a problem setting a cookie and doing a 302 redirect In chrome
I'm having a fun issue, I have LiveReload working in Chrome, so I know

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.