Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

java调用任务时截图颜色异常 #509

Closed
SCzfdf opened this issue Jan 5, 2025 · 12 comments
Closed

java调用任务时截图颜色异常 #509

SCzfdf opened this issue Jan 5, 2025 · 12 comments

Comments

@SCzfdf
Copy link

SCzfdf commented Jan 5, 2025

python调用是正常的

java调用
recognition_single_blue_ston_0_300000483_2025 00 05-10 26 00 802

python调用
recognition_single_blue_ston_0_300000001_2025 00 05-10 28 22 160

@SCzfdf
Copy link
Author

SCzfdf commented Jan 5, 2025

@hanhuoer @MistEO

@MistEO
Copy link
Member

MistEO commented Jan 5, 2025

是不是通道顺序错啦,maafw 给的是 bgr @hanhuoer

@hanhuoer
Copy link
Contributor

hanhuoer commented Jan 5, 2025

我这边测试下来没有复现,可以详细说说你是怎么使用的吗?或者提供一个最小用例。 @SCzfdf

以下是我的测试关健代码:

    @Test
    void postTaskCase() {
        bind();
        TaskFuture<TaskDetail> taskFuture = null;
//        taskFuture = tasker.postPipeline("rec_google_click");
        taskFuture = tasker.postPipeline("rec_sketchbook_click");
//        taskFuture = tasker.postPipeline("rec_via_click");
        taskFuture.waiting();
        TaskDetail taskDetail = taskFuture.get();
        log.info("task detail: {}", taskDetail);
    }

pipeline

{
  "rec_google_click": {
    "recognition": "TemplateMatch",
    "template": "google.png",
    "action": "Click"
  },
  "rec_sketchbook_click": {
    "recognition": "TemplateMatch",
    "template": "sketchbook.png",
    "action": "Click"
  },
  "rec_via_click": {
    "recognition": "TemplateMatch",
    "template": "via.png",
    "action": "Click"
  }
}

image

image

@hanhuoer
Copy link
Contributor

hanhuoer commented Jan 5, 2025

我这边又试了一下 controller 的截图功能,把文件保存下来后颜色没有异常,所以很好奇你那边的使用方式是什么 @SCzfdf

    @Test
    void screenshotTestCase() throws IOException {
        bind();
        BufferedImage screencap = tasker.controller().screencap();

        // save
        File file = FileUtils.join("screenshot", "ss_" + System.currentTimeMillis() + ".png");
        ImageIO.write(screencap, "png", file);

        // base64 image
        String base64 = ImageUtils.toBase64(screencap);
        System.out.println(base64);
    }

image

@SCzfdf
Copy link
Author

SCzfdf commented Jan 5, 2025

@hanhuoer
Copy link
Contributor

hanhuoer commented Jan 5, 2025

@hanhuoer https://github.com/SCzfdf/maa-random-dice 这个项目

你的项目是咋用的,跑起来后哪里能调试到颜色不对的地方,我这边跑了几次没看到图片 @SCzfdf


感觉不像是通道的问题,这边尝试调整通道后反而颜色不对了。

image

@SCzfdf
Copy link
Author

SCzfdf commented Jan 5, 2025

@hanhuoer https://github.com/SCzfdf/maa-random-dice 这个项目

你的项目是咋用的,跑起来后哪里能调试到颜色不对的地方,我这边跑了几次没看到图片 @SCzfdf

感觉不像是通道的问题,这边尝试调整通道后反而颜色不对了。

image

直接启动MaaRandomDiceApplication 。需要把debug的截图打开

hanhuoer added a commit to hanhuoer/maa-framework-java that referenced this issue Jan 5, 2025
@hanhuoer
Copy link
Contributor

hanhuoer commented Jan 5, 2025

@SCzfdf 换一个版本试试 2.1.4

调试好了,确实是通道的顺序问题

image

@SCzfdf
Copy link
Author

SCzfdf commented Jan 6, 2025

@SCzfdf 换一个版本试试 2.1.4

调试好了,确实是通道的顺序问题

image

ok截图顺序没问题了
不过现在会提示warn:
[2025-00-06 10:47:49.176][WRN][Px42448][Tx57223][Context.cpp][L202][std::optionalContext::PipelineData MaaNS::TaskNS::Context::get_pipeline_data(const std::string &)] task not found [task_name=recognition_single_blue_ston_2]

https://github.com/SCzfdf/maa-random-dice项目也更新了

这是日志
maa.log

@MistEO
Copy link
Member

MistEO commented Jan 8, 2025

task not found

就是字面意思,你的资源里没有 recognition_single_blue_ston_2,仅依靠 pipeline_override。尝试去覆盖资源,但资源里没找到

所以也是 warning 而不是 error

@SCzfdf
Copy link
Author

SCzfdf commented Jan 8, 2025

task not found

就是字面意思,你的资源里没有 recognition_single_blue_ston_2,仅依靠 pipeline_override。尝试去覆盖资源,但资源里没找到

所以也是 warning 而不是 error

但是我这个是runRecognition, 不是runTask. 也需要有?
而且有一部分是可以成功, 一部分报错
image

image

@MistEO @hanhuoer

@MistEO
Copy link
Member

MistEO commented Jan 8, 2025

需要

warning 不用管

@SCzfdf SCzfdf closed this as completed Jan 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants