get_histo_range strangeness - page 2 - Script Writing - CHDK Forum supplierdeeply

get_histo_range strangeness

  • 55 Replies
  • 6031 Views
Re: get_histo_range strangeness
« Reply #10 on: 17 / May / 2022, 13:56:19 »
Advertisements
I  wish the function to return the actual count, not a reconstructed interpretation ;)

*

Offline philmoz

  • *****
  • 3450
    • Photos
Re: get_histo_range strangeness
« Reply #11 on: 17 / May / 2022, 17:55:35 »
What I would like to ‘request’ is that the get_histo_range function, which is 10 bit, returns the actual count in the requested range and the total count. That is, rather than an integer percentage.


Changing the get_histo_range function might break existing scripts; but it would be fairly easy to add a new function to return the actual values (range and total).
CHDK ports:
  sx30is (1.00c, 1.00h, 1.00l, 1.00n & 1.00p)
  g12 (1.00c, 1.00e, 1.00f & 1.00g)
  sx130is (1.01d & 1.01f)
  ixus310hs (1.00a & 1.01a)
  sx40hs (1.00d, 1.00g & 1.00i)
  g1x (1.00e, 1.00f & 1.00g)
  g5x (1.00c, 1.01a, 1.01b)
  g7x2 (1.01a, 1.01b, 1.10b)

Re: get_histo_range strangeness
« Reply #12 on: 17 / May / 2022, 18:25:32 »
@philmoz

Yes I was also concerned about that, ie breaking existing scripts.

So, As you say, I would really welcome an additional get_histo_range acting like its live view cousin, ie returning the actual counts, eg get_histo_range_count(x,y), that returns the actual count between x and y. Total would be got from get_histo_range_count(0,1023)

*

Offline reyalp

  • ******
  • 14121
Re: get_histo_range strangeness
« Reply #13 on: 17 / May / 2022, 19:44:28 »
What I would like to ‘request’ is that the get_histo_range function, which is 10 bit, returns the actual count in the requested range and the total count. That is, rather than an integer percentage.

Is there any chance you would consider doing this?
Since rawop histo already provides access to total counts, I'm not really inclined to change get_histo_range.

edit:
But if simple and doesn't break anything I'm not going to object to phil adding something.
Don't forget what the H stands for.


*

Offline philmoz

  • *****
  • 3450
    • Photos
Re: get_histo_range strangeness
« Reply #14 on: 17 / May / 2022, 21:22:22 »
Since rawop histo already provides access to total counts, I'm not really inclined to change get_histo_range.


The rawop functions definitely provide more flexibility and features; but are more complex to understand and set up (compared to using shot_histo).


@pigeonhill - take a look at the drtest.lua script in the distribution for ideas on using the rawop system.

CHDK ports:
  sx30is (1.00c, 1.00h, 1.00l, 1.00n & 1.00p)
  g12 (1.00c, 1.00e, 1.00f & 1.00g)
  sx130is (1.01d & 1.01f)
  ixus310hs (1.00a & 1.01a)
  sx40hs (1.00d, 1.00g & 1.00i)
  g1x (1.00e, 1.00f & 1.00g)
  g5x (1.00c, 1.01a, 1.01b)
  g7x2 (1.01a, 1.01b, 1.10b)

Re: get_histo_range strangeness
« Reply #15 on: 18 / May / 2022, 00:35:45 »
@philmoz

Quote
@pigeonhill - take a look at the drtest.lua script in the distribution for ideas on using the rawop system.

I have, and as you say, it’s more complex to understand how to use it.

It would help if I had a simple snippet of code to look at, rather than a dense/honed script.

All I need to do is understand how to set up and use rawop to inspect a given slice of the histogram, ie to get the count in a zone.

Bottom line: this is not a make or break matter for me, it’s more a refinement to what I’m already achieving with shot_histo etc.

Thanks to your and @reyalp for you insight and support.
« Last Edit: 18 / May / 2022, 01:06:05 by pigeonhill »

*

Offline reyalp

  • ******
  • 14121
Re: get_histo_range strangeness
« Reply #16 on: 18 / May / 2022, 02:34:09 »
I have, and as you say, it’s more complex to understand how to use it.
Yeah, drtest is kinda complicated. Here's a fairly minimal example of just the histogram. Hopefully enough comments to be somewhat self explanatory.
Don't forget what the H stands for.

Re: get_histo_range strangeness
« Reply #17 on: 18 / May / 2022, 11:48:52 »
@reyalp

Many thanks for this snippet of code, it’s very clear now how I can use it.

A couple of questions if I may.

As this is RAW based, can assume the resultant histogram is linear, ie a gamma of 1.

I think I understand the xstep and ystep, but could you confirm that if, as you have, you use an odd number, ie 15, that means you will average the exposure over a 15x15 sensel area of the CFA.

Cheers

Garry



Update for @reyalp


Plus, do I assume I can only use the raw histo after taking an image, or can you interrogate the raw buffer at any time?
« Last Edit: 18 / May / 2022, 11:54:32 by pigeonhill »


*

Offline reyalp

  • ******
  • 14121
Re: get_histo_range strangeness
« Reply #18 on: 18 / May / 2022, 17:05:56 »
As this is RAW based, can assume the resultant histogram is linear, ie a gamma of 1.
It is generally assumed to be minimally modified raw counts from the sensor, before debayering or any color calibration. Of course, it's all undocumented so assumptions are at your own risk, but the fact CHDK DNG works as well as it does suggests this understanding is generally correct.
Quote
I think I understand the xstep and ystep, but could you confirm that if, as you have, you use an odd number, ie 15, that means you will average the exposure over a 15x15 sensel area of the CFA.
No. It means sample every 15th raw pixel (which again, are before debayering, which I guess you are calling sensel) in X and Y. FWIW, shot_histogram / get_histo_range uses the equivalent of 31.

Quote
Plus, do I assume I can only use the raw histo after taking an image
Yes, as documented in the rawop page, the raw buffer can only be read inside the raw hook, after a still shot is taken. This is why histo:update() is called after hook_raw.wait_ready(). As I've mentioned several times, raw sensor data is simply not available to CHDK (and almost certainly doesn't exist outside the sensor itself) except when a still shot is being processed.

get_histo_range is based on the data, so it has the same limitation, it just does the equivalent of histo:update for you automatically.
Don't forget what the H stands for.

Re: get_histo_range strangeness
« Reply #19 on: 18 / May / 2022, 17:14:22 »
@reyalp

Many thanks.

I think I get it now.

Cheers

Garry

 

Related Topics


SimplePortal 2.3.6 © 2008-2014, SimplePortal