Donc ne risque t'on pas de deterriorer l'image si on remappe sur 0-255 ?!
( Heureusement que c'est moi qui ai commencé ce post, on est en train de bien le faire derriver ... lol
![;)](https://www.homecinema-fr.com/forum/images/smilies/icon_wink.gif)
|
Modérateurs: Modération Forum Home-Cinéma, Le Bureau de l’Association HCFR • Utilisateurs parcourant ce forum: Aucun utilisateur enregistré et 20 invités
artefact a écrit:Je suis pas assez à fond pour suivre, mais bon courage. En espérant que tu es des réponses sur Doom9![]()
A+
Seb.26 a écrit:Ok, donc c'est le DVD qui "fait l'erreur", en gros : il ne devrait pas utiliser les valeurs 0->16 ... Mais il les utilise ...
Halfcat fr a écrit:Sur le PC, on lui fait faire le remapping en sortant du RVB32.
Si j'ai bien compris
sampler s0 : register(s0);
float4 p0 : register(c0);
float4 p1 : register(c1);
#define width (p0[0])
#define height (p0[1])
#define counter (p0[2])
#define clock (p0[3])
#define one_over_width (p1[0])
#define one_over_height (p1[1])
#define PI acos(-1)
#define NbPixel 1
#define Edge_threshold 0.2
#define Sharpen_val0 2.0
#define Sharpen_val1 0.125
float4 main(float2 tex : TEXCOORD0) : COLOR
{
// taille de NbPixel pixels
float dx = NbPixel/width;
float dy = NbPixel/height;
float4 Res = 0;
// Détection de contour par Prewitt
// récuppération des 9 points
// [ 1, 2, 3 ]
// [ 4, 0, 5 ]
// [ 6, 7, 8 ]
float4 c0 = tex2D(s0, tex);
float4 c1 = tex2D(s0, tex + float2(-dx,-dy));
float4 c2 = tex2D(s0, tex + float2(0,-dy));
float4 c3 = tex2D(s0, tex + float2(dx,-dy));
float4 c4 = tex2D(s0, tex + float2(-dx,0));
float4 c5 = tex2D(s0, tex + float2(dx,0));
float4 c6 = tex2D(s0, tex + float2(-dx,dy));
float4 c7 = tex2D(s0, tex + float2(0,dy));
float4 c8 = tex2D(s0, tex + float2(dx,dy));
// Calcul des 3 vecteurs dérivé (hor,vert, diag1, diag2)
float4 delta1 = (c6+c4+c1-c3-c5-c8);
float4 delta2 = (c4+c1+c2-c5-c8-c7);
float4 delta3 = (c1+c2+c3-c8-c7-c6);
float4 delta4 = (c2+c3+c5-c7-c6-c4);
// calcul du Prewitt
float value = length(abs(delta1) + abs(delta2) + abs(delta3) + abs(delta4))/6;
// Si c'est un contour (vector lenght > Edge_threshold) => filtre de sharpen
if(value > Edge_threshold )
{
Res = c0 * Sharpen_val0 - (c1 + c2 + c3 + c4 + c5 + c6 + c7 + c8 ) * Sharpen_val1 ;
// Pour voir les contour en rouge ...
//Res = float4( 1.0, 0.0, 0.0, 0.0 );
return Res;
}
else
return c0;
}
jim.ro a écrit:Hello !
Je me suis permis de partir de ton filtre EdgeSharpen.
jim.ro a écrit:J'ai simplement implémenté pour la détection de contour un filtre de Prewitt a la place du filtre de Roberts (théoriquement moins sensible au bruit) et mettre qq explications (ça motivera peut-être qq vocation).
sampler s0 : register(s0);
float4 p0 : register(c0);
float4 p1 : register(c1);
#define width (p0[0])
#define height (p0[1])
#define counter (p0[2])
#define clock (p0[3])
#define one_over_width (p1[0])
#define one_over_height (p1[1])
#define PI acos(-1)
float4 main( float2 tex : TEXCOORD0 ) : COLOR
{
float dx = one_over_width;
float dy = one_over_height;
// récuppération de la matrice de 9 points
// [ 1, 2 , 3 ]
// [ 4,ori, 5 ]
// [ 6, 7 , 8 ]
float4 ori = tex2D(s0, tex);
float4 c1 = tex2D(s0, tex + float2(-dx,-dy));
float4 c2 = tex2D(s0, tex + float2(0,-dy));
float4 c3 = tex2D(s0, tex + float2(dx,-dy));
float4 c4 = tex2D(s0, tex + float2(-dx,0));
float4 c5 = tex2D(s0, tex + float2(dx,0));
float4 c6 = tex2D(s0, tex + float2(-dx,dy));
float4 c7 = tex2D(s0, tex + float2(0,dy));
float4 c8 = tex2D(s0, tex + float2(dx,dy));
// calcul image floue (filtre gaussien)
float multipliers[9]=
{1,2,1,
2,4,2,
1,2,1};
float4 total=0;
total += c1 * multipliers[0];
total += c2 * multipliers[1];
total += c3 * multipliers[2];
total += c4 * multipliers[3];
total += ori * multipliers[4];
total += c5 * multipliers[5];
total += c6 * multipliers[6];
total += c7 * multipliers[7];
total += c8 * multipliers[8];
// 1/(1+2+1+2+4+2+1+2+1) = 1/ 16 = .0625
total *= 0.0625f;
// soustraction de l'image flou à l'image originale
total = 2*ori - total;
//return ori;
return total;
}
|
Retourner vers Matériel PC Home-cinéma |