Hi
I have problem with video card.
Video card send to my function image in yuy2 how displays on screen (direct3d or directdraw?), how to convers to rgb format ?
From http://www.fourcc.org/ i get formula to convers yuy2torgb and pictures is very green and violet
source code:
b = fixvalue(1.164383 * (y - 16) + 2.017232 * (u - 128))
g = fixvalue(1.164383 * (y - 16) - 0.391762 * (u - 128) - 0.812968 * (v - 128))
r = fixvalue(1.164383 * (y - 16) + 1.596027 * (v - 128))
tmp(l) = r
tmp(l + 1) = g
tmp(l + 2) = b
l += 3
Best regards
Tomek
Try StreamFab Downloader and download from Netflix, Amazon, Youtube! Or Try DVDFab and copy Blu-rays! or rip iTunes movies!
+ Reply to Thread
Results 1 to 3 of 3
Thread
-
-
This looks like a YUV image being decoded as if it was RGB. i.e., what ever is decoding the frame thinks it is RGB but it is really YUV.
Can you give more information?
Are you sending a frame to the video card or are you getting the frame from the video card?
Can you post the complete function for converting YUY2 to RGB?John Miller -
Video Card send image to my function in format YUY2 or YUV 4:2:2 (all have same code 0x44)
function fixvalues fix to 0-255
My whole convert function :
public obrazkamera() as byte
Function Yuy2toRgb() As Byte()
Dim y, y1, u, v As Integer
Dim r, g, b As Byte
Dim r1, g1, b1 As Byte
Dim i, j, l As Integer
Dim tmp() As Byte
Dim YUYwidth, YUYheight As Integer
Dim dlugoscYUY As Integer
Dim punkt As Long
YUYwidth = 320
YUYheight = 240
ReDim tmp(YUYwidth * YUYheight * 3)
YUYwidth = YUYwidth - 1 'uwaga
dlugoscYUY = '(YUYwidth) * 2
l = 0
If obrazkamera Is Nothing Then
Yuy2toRgb = tmp
Exit Function
End If
For j = 0 To YUYheight - 1
For i = 0 To dlugoscYUY - 2 Step 2
punkt = j * (dlugoscYUY) + i
If i Mod 4 = 0 Then
y = CInt(obrazkamera(punkt))
u = CInt(obrazkamera(punkt + 1))
v = CInt(obrazkamera(punkt + 3))
Else
u = CInt(obrazkamera(punkt - 1))
v = CInt(obrazkamera(punkt + 1))
y = CInt(obrazkamera(punkt))
End If
r = fixvalue(1.164383 * (y - 16) + 1.596027 * (v - 128))
g = fixvalue(1.164383 * (y - 16) - 0.391762 * (u - 128) - 0.812968 * (v - 128))
b = fixvalue(1.164383 * (y - 16) + 2.017232 * (u - 128))
tmp(l) = r
tmp(l + 1) = g
tmp(l + 2) = b
l += 3
Next
Next
End Function
Similar Threads
-
WMV File with YUY2 Raw Video Format
By toreachdeepak in forum Video ConversionReplies: 3Last Post: 24th Feb 2011, 09:43 -
What format for raw encoding? VOB, AVI or MP4
By Vman94 in forum Newbie / General discussionsReplies: 1Last Post: 22nd Oct 2010, 11:00 -
Converting raw DV format into a quicktime or MPEG format
By Maiden in forum Camcorders (DV/HDV/AVCHD/HD)Replies: 80Last Post: 27th Apr 2009, 20:00 -
dvd-rw discs show up as raw file format
By Bertieboo in forum MediaReplies: 3Last Post: 20th Nov 2007, 09:44 -
Raw YUY2 to YV12 format?
By allyli2007 in forum ProgrammingReplies: 8Last Post: 2nd Jun 2007, 12:43