×

INDI Library v2.0.6 is Released (02 Feb 2024)

Bi-monthly release with minor bug fixes and improvements

INDI LibCamera Driver

  • Posts: 74
  • Thank you received: 11

Replied by Anjo on topic INDI LibCamera Driver

So the conversion is just needed for fits. Got it.
1 year 3 months ago #88765

Please Log in or Create an account to join the conversation.

  • Posts: 74
  • Thank you received: 11

Replied by Anjo on topic INDI LibCamera Driver

OK, I fixed the libcamera build files to built statics. So you can now

mkdir build && cd build && cmake .. && make

and get a fully static built driver which does not rely on the shared libs. So that's one step less and should make debugging easier as you can now set breakpoints in the libcamera app code

The most pressing issues are:

- provide a way to set and parse the options. Again, for now I'd strongly advise to just use a string field and let the Options parse it. UI can come later
- first step for UI should be gain, I guess
- fix DNG. Apparently when doing raw exposures, you'll get yuv instead of dng, so the saving stuff should consider that.
- figure out the stablity issues when doing video. It works for a few times, until it doesn't and crashes. What I see is a LOT of threads getting created but I haven't figured out why or how.

Also, there seems a link between image exposure type and stream type.
The following user(s) said Thank You: Simon
1 year 3 months ago #88809

Please Log in or Create an account to join the conversation.

Replied by Jasem Mutlaq on topic INDI LibCamera Driver

You have the stream thread + each time a new frame is dispatched, a thread is created to upload the image to the client and then destroyed. This is why you see so many threads.
The following user(s) said Thank You: R Dan Nafe
1 year 3 months ago #88810

Please Log in or Create an account to join the conversation.

  • Posts: 74
  • Thank you received: 11

Replied by Anjo on topic INDI LibCamera Driver

Wow, ok. Isn't that pretty inefficient? Why not have a queue that the sending thread listens on?
1 year 3 months ago #88811

Please Log in or Create an account to join the conversation.

Replied by Jasem Mutlaq on topic INDI LibCamera Driver

There is already a queue actually and you can see it creating a thread from the preview thread pool . If you can make this operation more efficient, then that's great!
1 year 3 months ago #88813

Please Log in or Create an account to join the conversation.

  • Posts: 106
  • Thank you received: 33

Replied by Simon on topic INDI LibCamera Driver

@Anjo, that's awsome progress! I'll try to checkout your branch and build it by your instruction as soon as I can.
1 year 3 months ago #88827

Please Log in or Create an account to join the conversation.

  • Posts: 74
  • Thank you received: 11

Replied by Anjo on topic INDI LibCamera Driver

Either I'm too stupid or the options parsing is broken (as it was from the beginning, btw).

This here prints totally weird values and even crashes. Any Idea why?

<code>
static int parseArgs(char *str, char *delim, char **argv, int max)
{
int argc = 0;
char* token = strtok(str, delim);
argv[argc++] = token;
while (token != NULL) {
token = strtok(NULL, delim);
argv[argc++] = token;
if(max < argc) {
break;
}
}

return argc-1;
}

static void doArgs(char *str)
{
Options option = StillOptions();
printf("-->\n");
char *argv[64] = {};
char delim[] = " \t\n";
int argc = parseArgs(str, delim, argv, sizeof(argv));
printf("%d\n", argc);
for(int i = 0; i < argc; i++) {
char *token = argv;
printf("0x%8lx >%s<\n", token, token);
}
option.Parse(argc, argv);
option.Print();
printf("--<\n");
}

INDILibCamera::INDILibCamera()
{
char str1[] = "--config /tmp/config.txt";
doArgs(str1);
...
</code>

The config file contains this, but that doesn't really matter- even when you give a normal args string, you just get a garbage Options:

<code>
pi@astrocam:~/astro/indi-3rdparty/build/indi-libcamera $ cat /tmp/config.txt
-n -t 0 -o - --awbgains 1,1 --immediate
</code>
Last edit: 1 year 3 months ago by Anjo.
1 year 3 months ago #88843

Please Log in or Create an account to join the conversation.

  • Posts: 106
  • Thank you received: 33

Replied by Simon on topic INDI LibCamera Driver

@Anjo, can you put link here to your development branch, so that I can test the code?
1 year 3 months ago #88855

Please Log in or Create an account to join the conversation.

  • Posts: 74
  • Thank you received: 11

Replied by Anjo on topic INDI LibCamera Driver

github.com/anjok/indi-3rdparty/tree/libcamera

If you send me your github nick, I can add you as a collaborator.
1 year 3 months ago #88867

Please Log in or Create an account to join the conversation.

  • Posts: 123
  • Thank you received: 13

Replied by Outta on topic INDI LibCamera Driver

Inhave been testing Anjos brilliant work with IMX462.

I got exposure and I got streaming!

Although it is limited to 640x480, and only jpeg stills. DNG says "unknown bayer format" trying to debug that.

I see there are modes added manually, I think we can pull them from libcamera, same way as libcamera-vid - - list-cameras work.
All in all it is great to see exposure and stream work!
Last edit: 1 year 3 months ago by Outta.
1 year 3 months ago #88878

Please Log in or Create an account to join the conversation.

  • Posts: 74
  • Thank you received: 11

Replied by Anjo on topic INDI LibCamera Driver

First of all, lets all thank Jasem to get this thing started in the first place. I just fixed a few things :)

The unknown bayer is because it's not a raw stream, but a yuv420 stream instead.

The 640x480 is because the width and height are never set and so they use the default - like everything else They should be set from the respective number properties in the Indi:CCD. Note that subframing would need to be translated from XY to 0..1x0..1, btw

I still think it would be faster if someone found out why the args parsing doesn't work. I don't have time for that right now, though.

That way, we could quickly try out various settings without needing to create UI for it. Eg, do you know what "gain" or "rotation" should be named like to get it recognized by ekos? And there's no libcamera-util --list-controls where you could find out about them like there is for v4l2.

I would prefer if there were two text files, "video.conf" and "still.conf" (maybe setable by indi props) that would be used as the config templates and then gradually add UI for the rest. You can't hardcode the values, since all cams will be different and testing out these values has been a bitch so far.

Picking things out of the apps is nice, but costs time that could be better spent on other things.

For later, I would really like in-app stacking - in particular for video - like the v4l2 client partially does.

Also note that to get a reasonable stream, you first need to expose for some reason. Dunno why.
The following user(s) said Thank You: Jasem Mutlaq
1 year 3 months ago #88884

Please Log in or Create an account to join the conversation.

  • Posts: 74
  • Thank you received: 11

Replied by Anjo on topic INDI LibCamera Driver

Actually, we should probably just subclass/copy our own LibcameraIndiApp for now in the indi part of the code.
1 year 3 months ago #88885

Please Log in or Create an account to join the conversation.

Time to create page: 1.215 seconds