Calculate the correct ISO and exposure compensation based on the ambient light

I do not know what "exposure compensation value" means (is it EV?), But there is no automatic way to do that. Simply put, there are four parameters that define how bright (a bit) the image will be:

  • how bright the scene (or bit thereof corresponding to the bit of the picture) is, b;
  • how sensitive the sensor is, s, which essentially corresponds to its ISO (see below);
  • the exposure time t in seconds;
  • the aperture a, given as f / 11 or whatever, which we interpret as 1/11 or whatever.

The brightness of the image is then approximately proportional to

b s t a2

As a result, if you know b, you can adjust s, t, and a to get an equally bright picture. As an example, if

  • t = 1/100 second
  • s = 100
  • a = 1/8

then t a ^ 2 = 1/64. But if

t = 1/50 second
s = 100
a = 1/11

then t a ^ 2 = 2/121, which is very close to 1/64.

In other words, an exposure of 1/50 at 1:11 equals 1/100 at 1: 8.

Likewise, I can set s:

  • t = 1/200 second
  • s = 200
  • a = 1/8

s t a ^ 2 = 1/64: An exposure of 1 / 200s at ISO 200 at f / 8 equals 1 / 100s at ISO 100 at f / 8.

If you know b, then there is one Infinite number combinations of t, s and a that work: what you select depends on factors other than the brightness of the scene.

A note on s: I wrote above as if you could vary the sensitivity, which you really can not do: the sensor in the camera is as sensitive as it is. What you can They then multiply the output of the sensor by a factor which, for these purposes, corresponds to the control of s. It's not really equivalent because of issues like noise and dynamic range, but it's good enough here.

(Of course, you can change the sensitivity of the sensor in a movie camera by changing the movie.)

Unit – Calculate the position of the mesh at the top, bottom, left, and right with respect to the mouse click position on the mesh

I have a net (suppose it can be a circle or a rectangle, a square or a square) bow). The geometry of the network can be arbitrary. I can click on Net at any point. With regard to the clicked position, I would like to determine the right, left upper and lower position of the net. Maybe the picture explains it better than my words Enter image description here

How to calculate the explicit formula of $ E_ {ac} (d lambda) $?


When A is self-conjugated in Hlibert space $ H $, then for almost everyone $ lambda $
begin {equation}
left langle E_ {ac} (d lambda) f, g right rangle = left langle frac {1} {2i pi} (R ( lambda + i0) -R ( lambda-i0 )) f, g right rangle d lambda.
end {equation}

Where $ E_ {ac} = E cdot P_ {ac} $, and $ P_ {ac} $ is the projection on the subspace $ H_ {ac} $,

Proof: The proof is followed by the functional calculation, more precisely

$ RHS = left langle frac {1} {2i pi} (R ( lambda + i0) -R ( lambda-i0)) f, g right rangle d lambda $

$ = lim _ { varepsilon to 0 ^ +} left langle frac {1} {2i pi} (R ( lambda + i varepsilon) -R ( lambda-i varepsilon)) f , g right rangle d lambda $

$ = lim _ { varepsilon to 0 ^ +} int frac {1} {2i pi} ( frac {1} {t – ( lambda + i varepsilon)} – frac {1} {t – ( lambda-i varepsilon)}) left langle E (dt) f, g right rangle $

$ = lim _ { varepsilon to 0 ^ +} int frac {1} { pi} frac { varepsilon} {(t- lambda) ^ 2 + varepsilon ^ 2} left langle E (dt) f, g right rangle $

$ = frac { left langle E_ {ac} (d lambda) f, g right rangle} {d lambda} $ $ qquad $$ qquad $(*)

for almost every where $ lambda $,

And I wonder how I can get the last restriction (*)?

java – Calculate the age with JavaScript


I have a format date of "21/01/1982" which I bring with JAVA from the backend and which I show with JSP tags.

My intention is to capture this data from a table in HTML and, depending on "n" of the number of records, to convert the birth date to age using JS.

I tried to use the onload event on td, for example:


Unfortunately Onload does not work for these types of tags. The situation is that as a table I have to pass the data to the function as that load so that it will calculate all the data and not just the first or the last one to load.

I've been thinking about doing it with JS because he gave me work with JAVA, but now I'm also complicated with JS, hehe.

Is there an event that you can call from the birth date field to pass the birth date parameter so that you can calculate the age?

How to calculate the predecessor subgraphs in the all-pair shortest path algorithm?

The following slow algorithm (implemented from the CLRS book) running in $ Theta (V ^ 4) $ works well for calculating the shortest distances distances:

def extendShortestPath(L, PI, W):
    n = len(L)
    Lprime = ((float('inf') for x in range(n)) for y in range(n))
    PIprime = ((-1 for x in range(n)) for y in range(n))
    for i in range(n):
        for j in range(n):
            for k in range(n):
                if (Lprime(i)(j) > L(i)(k) + W(k)(j)):
                    Lprime(i)(j) = L(i)(k) + W(k)(j)
                    PIprime(i)(j) = k        # does not work!
                    PIprime(i)(k) = PI(i)(k) # does not work!
    return Lprime, PIprime

def slowAllPairsShortestPaths(W):
    n = len(W)
    L = W
    PI = ((-1 for x in range(n)) for y in range(n))
    for m in range(1, n):
        L, PI = extendShortestPath(L, PI, W)
    return L, PI

if __name__ == '__main__':
    W = ((float('inf') if x != y else 0 for x in range(5)) for y in range(5))
    W(0)(1) = 3
    W(0)(2) = 8
    W(0)(4) = -4
    W(1)(3) = 1
    W(1)(4) = 7
    W(2)(1) = 4
    W(3)(0) = 2
    W(3)(2) = -5
    W(4)(3) = 6
    L, PI = slowAllPairsShortestPaths(W)

Enter image description here
Enter image description here

In addition to calculating the shortest path distances, I must also determine the predecessor vertex of each vertex in the graph for each source vertex. I understand that the relaxing step determines the predecessor. So I added the commented lines extendShortestPath but it does not seem to work. How can I calculate the predecessor subgraphs?

To generate an efficient way to calculate one?

How can I generate an efficient calculation graph for a case like the following?

$$ X_ {ik} M_ {ij} M_ {kl} X_ {jl} $$

The indices range from $ 1 $ to $ d $ and the goal is to minimize the assumed computation time $ d $ is big. IE, dear $ O (d ^ {k}) $ is cheaper than $ O (d ^ {k + 1}) $, For the above sum, it can be calculated as follows:

$$ A_ {kj} = X_ {ik} M_ {ij} \ B_ {kj} = M_ {kl} X_ {jl} \ c = A_ {kj} B_ {kj} $$

You can specify this solution in the form of indices that appear in the expression


Even more compact, the problem and the solution can be coded as follows:

input: {ik, ij, kl, jl}
output: {{ik, ij}, {kl, jl}}

This is probably an NP-complete problem, but there are likely to be heuristics that will make it possible to find an efficient solution most of the time.

Optimization – How does the MySQL optimizer calculate the join cost when indexed?

The theoretical standard formula is so

C (R1.R2) = C (R1) + T (R1) * C (R2) where

C (R1.R2) – costs for linking two relations (tables) R1 and R2

C (R1) – Reading Relation Costs R1

C (R2) – Cost of reading the relationship R2

T (R1) – total number of rows in R1

Apparently, this is the formula for nested loop join, if related for each row R1 and the loop checks to see if a matching row is related R2, But since MySQL creates an index for FK, does not it have to do NLJ right? What happens and how are the costs calculated?

hdr – How to correctly calculate the dynamic range of an image

First, regardless of the definition of the dynamic range, it does not make sense to compute the luminance "anything to zero" since the ratio then becomes infinite. Your:


is another way of saying


and we can not divide by zero (and log2 (0) is undefined)

So let's forget the 0 for now (zero means that the image is not well exposed anyway, because you can not have details at level 0), then in fact:

log2(255)-log2(1) = ~8 (EV)

However, this is not the dynamic range, as in JPEG (and sRGB in general) pixels values are not pixels luminance,

Taking into account the correct gamma formula, we finally get:

log2(1)-log2(1/3294.6) = ~12 (EV)

(See also: 8-bit monitor, theoretical contrast)

datetime – SQL Server – Identify overlapping time entries and calculate time without overlaps

Here is my example set up in rextester.

I have the following table in gray (the two columns on the far right are for explanation).

Enter image description here

As you can see, an employee's time entries may overlap. This is sorted by
Labor start from the latest to the newest.

I want Select these overlapping time entries and Calculate the time correctly without overlaps,

I managed to do something, but had to resort to 2 subqueries and 2 auxiliary columns.

Enter image description here

Here is my code.


,(CASE WHEN Y.NewEndTimeLag > Y.NewEndTime
   THEN 0

   WHEN Y.LaborStart <= Y.NewEndTimeLag
   THEN DATEDIFF((MINUTE), Y.NewEndTimeLag, Y.NewEndTime)

   ELSE DATEDIFF((MINUTE), Y.LaborStart, Y.NewEndTime)
   END)    AS (New Time Spent) 

,(CASE WHEN Y.LaborStart < Y.NewEndTimeLag
   THEN 1

   ELSE 0 END) AS (Time Overlap? (1=Yes 0=No))


  , LAG(X.NewEndTime,1) OVER (PARTITION BY X.Employee ORDER BY X.Employee, X.LaborStart) AS (NewEndTimeLag)

  FROM (

                        , Employee
                        , LaborStart
                        , LaborEnd  

                        , (CASE WHEN LaborEnd <= LAG(LaborEnd,1,LaborEnd) OVER (PARTITION BY Employee, MONTH(LaborStart), DAY(LaborStart)  ORDER BY Employee, LaborStart)
                    THEN LAG(LaborEnd,1,LaborEnd) OVER (PARTITION BY Employee, MONTH(LaborStart), DAY(LaborStart)  ORDER BY Employee, LaborStart) 
                    ELSE LaborEnd END ) AS (NewEndTime)

                    FROM (WorkEntries)

                    GROUP BY
                    , Employee
                    , LaborStart
                    , LaborEnd
  ) X

) Y


I appreciate any advice to improve this query or the logic behind it!