Fix D2R region coordinates and HSV calibration from real screenshot
- Health orb: (370,945)-(460,1030) — verified red center RGB(196,18,16) - Mana orb: (1580,910)-(1670,1000) — verified blue center HSV(228,94,73) - Health HSV tightened to H 0-10, S 150+, V 150+ - Mana HSV tightened to H 200-240, S 100+, V 80+ - Belt, skill regions also recalibrated - 720p regions scaled proportionally
This commit is contained in:
parent
a665253d4d
commit
0716aeb5e1
6 changed files with 32 additions and 31 deletions
|
|
@ -33,17 +33,17 @@ func main() {
|
||||||
debugDir := "testdata/debug"
|
debugDir := "testdata/debug"
|
||||||
os.MkdirAll(debugDir, 0755)
|
os.MkdirAll(debugDir, 0755)
|
||||||
|
|
||||||
// Define regions for 1080p (from config.go)
|
// Define regions for 1080p (from config.go — calibrated from real screenshot)
|
||||||
regions := map[string]image.Rectangle{
|
regions := map[string]image.Rectangle{
|
||||||
"health_orb": image.Rect(28, 545, 198, 715),
|
"health_orb": image.Rect(370, 945, 460, 1030),
|
||||||
"mana_orb": image.Rect(1722, 545, 1892, 715),
|
"mana_orb": image.Rect(1580, 910, 1670, 1000),
|
||||||
"xp_bar": image.Rect(0, 1058, 1920, 1080),
|
"xp_bar": image.Rect(0, 1058, 1920, 1080),
|
||||||
"belt": image.Rect(838, 1010, 1082, 1058),
|
"belt": image.Rect(500, 990, 900, 1040),
|
||||||
"minimap": image.Rect(1600, 0, 1920, 320),
|
"minimap": image.Rect(1600, 0, 1920, 320),
|
||||||
"inventory": image.Rect(960, 330, 1490, 770),
|
"inventory": image.Rect(960, 330, 1490, 770),
|
||||||
"stash": image.Rect(430, 330, 960, 770),
|
"stash": image.Rect(430, 330, 960, 770),
|
||||||
"skill_left": image.Rect(194, 1030, 246, 1078),
|
"skill_left": image.Rect(200, 1030, 250, 1078),
|
||||||
"skill_right": image.Rect(1674, 1030, 1726, 1078),
|
"skill_right": image.Rect(1670, 1030, 1730, 1078),
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Println("\n=== REGION ANALYSIS ===")
|
fmt.Println("\n=== REGION ANALYSIS ===")
|
||||||
|
|
|
||||||
BIN
debug
BIN
debug
Binary file not shown.
|
|
@ -678,15 +678,15 @@ func (s *Server) getExpectedColorRange(regionName string) *vision.ColorRange {
|
||||||
switch regionName {
|
switch regionName {
|
||||||
case "health_orb":
|
case "health_orb":
|
||||||
return &vision.ColorRange{
|
return &vision.ColorRange{
|
||||||
LowerH: 0, UpperH: 30,
|
LowerH: 0, UpperH: 10,
|
||||||
LowerS: 50, UpperS: 255,
|
LowerS: 150, UpperS: 255,
|
||||||
LowerV: 30, UpperV: 255,
|
LowerV: 150, UpperV: 255,
|
||||||
}
|
}
|
||||||
case "mana_orb":
|
case "mana_orb":
|
||||||
return &vision.ColorRange{
|
return &vision.ColorRange{
|
||||||
LowerH: 200, UpperH: 240,
|
LowerH: 200, UpperH: 240,
|
||||||
LowerS: 40, UpperS: 255,
|
LowerS: 100, UpperS: 255,
|
||||||
LowerV: 20, UpperV: 255,
|
LowerV: 80, UpperV: 255,
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
// For other regions, we don't have specific expected color ranges
|
// For other regions, we don't have specific expected color ranges
|
||||||
|
|
|
||||||
|
|
@ -56,11 +56,11 @@ type Config struct {
|
||||||
func DefaultConfig() Config {
|
func DefaultConfig() Config {
|
||||||
return Config{
|
return Config{
|
||||||
Colors: Colors{
|
Colors: Colors{
|
||||||
// Tightened HSV ranges based on real D2R screenshot calibration
|
// Calibrated HSV ranges from real D2R screenshot (testdata/d2r_1080p.png)
|
||||||
// Health orb is RED: H 0-30 (covering red wrapping), S 50-255, V 30-255
|
// Health orb is bright RED: RGB ~(236,15,20) → HSV H 0-10, S 150+, V 150+
|
||||||
HealthFilled: HSVRange{0, 50, 30, 30, 255, 255},
|
HealthFilled: HSVRange{0, 150, 150, 10, 255, 255},
|
||||||
// Mana orb is BLUE: H 200-240, S 40-255, V 20-255
|
// Mana orb is BLUE: H 200-240, S 100+, V 80+
|
||||||
ManaFilled: HSVRange{200, 40, 20, 240, 255, 255},
|
ManaFilled: HSVRange{200, 100, 80, 240, 255, 255},
|
||||||
ItemUnique: HSVRange{15, 100, 180, 30, 255, 255},
|
ItemUnique: HSVRange{15, 100, 180, 30, 255, 255},
|
||||||
ItemSet: HSVRange{35, 100, 150, 55, 255, 255},
|
ItemSet: HSVRange{35, 100, 150, 55, 255, 255},
|
||||||
ItemRare: HSVRange{15, 50, 200, 25, 150, 255},
|
ItemRare: HSVRange{15, 50, 200, 25, 150, 255},
|
||||||
|
|
@ -90,37 +90,38 @@ func DefaultConfig() Config {
|
||||||
func RegisterProfiles(registry *resolution.Registry) error {
|
func RegisterProfiles(registry *resolution.Registry) error {
|
||||||
profiles := []*resolution.Profile{
|
profiles := []*resolution.Profile{
|
||||||
// 1920x1080 (1080p) - Primary resolution
|
// 1920x1080 (1080p) - Primary resolution
|
||||||
|
// Calibrated from real D2R screenshot (testdata/d2r_1080p.png)
|
||||||
{
|
{
|
||||||
Width: 1920,
|
Width: 1920,
|
||||||
Height: 1080,
|
Height: 1080,
|
||||||
Label: "1080p",
|
Label: "1080p",
|
||||||
Regions: map[string]image.Rectangle{
|
Regions: map[string]image.Rectangle{
|
||||||
"health_orb": image.Rect(28, 545, 198, 715),
|
"health_orb": image.Rect(370, 945, 460, 1030),
|
||||||
"mana_orb": image.Rect(1722, 545, 1892, 715),
|
"mana_orb": image.Rect(1580, 910, 1670, 1000),
|
||||||
"xp_bar": image.Rect(0, 1058, 1920, 1080),
|
"xp_bar": image.Rect(0, 1058, 1920, 1080),
|
||||||
"belt": image.Rect(838, 1010, 1082, 1058),
|
"belt": image.Rect(500, 990, 900, 1040),
|
||||||
"minimap": image.Rect(1600, 0, 1920, 320),
|
"minimap": image.Rect(1600, 0, 1920, 320),
|
||||||
"inventory": image.Rect(960, 330, 1490, 770),
|
"inventory": image.Rect(960, 330, 1490, 770),
|
||||||
"stash": image.Rect(430, 330, 960, 770),
|
"stash": image.Rect(430, 330, 960, 770),
|
||||||
"skill_left": image.Rect(194, 1030, 246, 1078),
|
"skill_left": image.Rect(200, 1030, 250, 1078),
|
||||||
"skill_right": image.Rect(1674, 1030, 1726, 1078),
|
"skill_right": image.Rect(1670, 1030, 1730, 1078),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
// 1280x720 (720p) - Secondary resolution
|
// 1280x720 (720p) - Secondary resolution (scaled from 1080p)
|
||||||
{
|
{
|
||||||
Width: 1280,
|
Width: 1280,
|
||||||
Height: 720,
|
Height: 720,
|
||||||
Label: "720p",
|
Label: "720p",
|
||||||
Regions: map[string]image.Rectangle{
|
Regions: map[string]image.Rectangle{
|
||||||
"health_orb": image.Rect(19, 363, 132, 477),
|
"health_orb": image.Rect(247, 630, 307, 687),
|
||||||
"mana_orb": image.Rect(1148, 363, 1261, 477),
|
"mana_orb": image.Rect(1053, 607, 1113, 667),
|
||||||
"xp_bar": image.Rect(0, 705, 1280, 720),
|
"xp_bar": image.Rect(0, 705, 1280, 720),
|
||||||
"belt": image.Rect(559, 673, 721, 705),
|
"belt": image.Rect(333, 660, 600, 693),
|
||||||
"minimap": image.Rect(1067, 0, 1280, 213),
|
"minimap": image.Rect(1067, 0, 1280, 213),
|
||||||
"inventory": image.Rect(640, 220, 993, 513),
|
"inventory": image.Rect(640, 220, 993, 513),
|
||||||
"stash": image.Rect(287, 220, 640, 513),
|
"stash": image.Rect(287, 220, 640, 513),
|
||||||
"skill_left": image.Rect(129, 685, 164, 718),
|
"skill_left": image.Rect(133, 687, 167, 718),
|
||||||
"skill_right": image.Rect(1116, 685, 1151, 718),
|
"skill_right": image.Rect(1113, 687, 1153, 718),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
||||||
BIN
testdata/debug/debug_health_orb.png
vendored
BIN
testdata/debug/debug_health_orb.png
vendored
Binary file not shown.
|
Before Width: | Height: | Size: 33 KiB After Width: | Height: | Size: 9.9 KiB |
BIN
testdata/debug/debug_mana_orb.png
vendored
BIN
testdata/debug/debug_mana_orb.png
vendored
Binary file not shown.
|
Before Width: | Height: | Size: 32 KiB After Width: | Height: | Size: 15 KiB |
Loading…
Add table
Add a link
Reference in a new issue