Narzędzia użytkownika

Narzędzia witryny


notatki:autofocus

Różnice

Różnice między wybraną wersją a wersją aktualną.

Odnośnik do tego porównania

Poprzednia rewizja po obu stronachPoprzednia wersja
Nowa wersja
Poprzednia wersja
notatki:autofocus [2025/05/21 20:07] administratornotatki:autofocus [2025/05/21 20:44] (aktualna) administrator
Linia 1: Linia 1:
 ====== Hardware: Jak działa autofocus? ====== ====== Hardware: Jak działa autofocus? ======
  
-====== Wyostrzanie poprzez pomiar odległości (pasywne) ======+narzędzia wykorzystane: 
 +  * https://phydemo.app/ray-optics/simulator/ 
 +  * https://imagej.net/ij/
  
 +====== Wyostrzanie poprzez pomiar odległości (aktywne) ======
  
 +{{ :notatki:autofocus1.svg |}}
  
 $$ $$
Linia 40: Linia 44:
  
 <diagram><svg xmlns="http://www.w3.org/2000/svg" style="background: transparent; background-color: transparent; color-scheme: light dark;" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="931px" height="144px" viewBox="-0.5 -0.5 931 144" content="&lt;mxfile host=&quot;wiki.ostrowski.net.pl&quot; agent=&quot;Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:138.0) Gecko/20100101 Firefox/138.0&quot; version=&quot;26.2.15&quot;&gt;&lt;diagram id=&quot;mRD1LMbev2ZDhoJVxo4r&quot; name=&quot;Page-1&quot;&gt;1VfLjtsgFP0aL0cCk1eXSTpuF61UNYuukbmx0WCwMEmcfn0hxu882iqTUbxI8PHl3Mu5J4YEZJ2VXzTN0++KgQhCxMqAfA5Ce81n9sshxwpZYFIBieasgnALbPhv8CDy6I4zKHqBRilheN4HYyUlxKaHUa3VoR+2VaKfNacJjIBNTMUY/cWZSf0qpqjFvwJP0jozRv5JRutgDxQpZerQgchrQNZaKVONsnINwolX61LNiy48bQrTIM3fTAirCXsqdn5tvi5zrBcLki2dZvYuFrQoeByQVWGoNmM4NZmwALZDrXaSgUuD7F3FCmyka1sobpZvfQMqA6OPNuTQClzrm3a0rTENghq+79NT3+ekoWsy/FDcJg6R9+QLrom8JScz1Oco1E7H4Kd1FR0wzW8RWeUSMCMiO+isu4VODTvfPHK7efFO709NcC3pdFIqCdf6VRit3hpzhw2yVkLpEzWJImSv2gsRd2U+Ra/x/E6tnt0iutBq2wR67ITlLqC4XPBkmGeCrtY1Jf14srgRv7jKbwdVxf/r08mH+hQvo4jgJ/Tpy92MSshjjIqHeW4YFX8aGHV+PT6cvK9RpyOjfuMSqHZeBVkoN8h5CaIYGdhAafpGpYIn0u2O1k1gvbjagzbcHiKW/kHGGXPTV4eUG9jkNHZcB3tkurB9OgIo/9WstXZ4et4DHTM3B6yum8nAK13j9javK8LORsL+PBlLbe2HOOUK0fLBom6VNOfeE/cQe/BDmKKx2LN30nr+BFo3Z4c7aE3Qw7S2t+3RvHq/tH9wyOsf&lt;/diagram&gt;&lt;/mxfile&gt;"><defs/><g><g data-cell-id="0"><g data-cell-id="1"><g data-cell-id="2"><g><path d="M 27.37 73 L 914.63 73" fill="none" stroke="#000000" style="stroke: light-dark(rgb(0, 0, 0), rgb(255, 255, 255));" stroke-miterlimit="10" pointer-events="stroke"/><path d="M 22.12 73 L 29.12 69.5 L 27.37 73 L 29.12 76.5 Z" fill="#000000" style="fill: light-dark(rgb(0, 0, 0), rgb(255, 255, 255)); stroke: light-dark(rgb(0, 0, 0), rgb(255, 255, 255));" stroke="#000000" stroke-miterlimit="10" pointer-events="all"/><path d="M 919.88 73 L 912.88 76.5 L 914.63 73 L 912.88 69.5 Z" fill="#000000" style="fill: light-dark(rgb(0, 0, 0), rgb(255, 255, 255)); stroke: light-dark(rgb(0, 0, 0), rgb(255, 255, 255));" stroke="#000000" stroke-miterlimit="10" pointer-events="all"/></g></g><g data-cell-id="3"><g><path d="M 341 73 Q 641 53 671 23 Q 701 -7 726 23 Q 751 53 841 73" fill="none" stroke="#ff0000" style="stroke: light-dark(rgb(255, 0, 0), rgb(255, 144, 144));" stroke-width="2" stroke-miterlimit="10" pointer-events="stroke"/></g></g><g data-cell-id="4"><g><path d="M 1 73 Q 301 53 331 18 Q 361 -17 386 18 Q 411 53 501 73" fill="none" stroke="#1aff31" style="stroke: light-dark(rgb(26, 255, 49), rgb(0, 127, 0));" stroke-width="2" stroke-miterlimit="10" pointer-events="stroke"/></g></g><g data-cell-id="5"><g><rect x="386" y="73" width="210" height="30" fill="none" stroke="none" pointer-events="all"/></g><g><g transform="translate(-0.5 -0.5)"><switch><foreignObject style="overflow: visible; text-align: left;" pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 208px; height: 1px; padding-top: 88px; margin-left: 387px;"><div style="box-sizing: border-box; font-size: 0; text-align: center; color: #000000; "><div style="display: inline-block; font-size: 12px; font-family: &quot;Helvetica&quot;; color: light-dark(#000000, #ffffff); line-height: 1.2; pointer-events: all; white-space: normal; word-wrap: normal; ">Linear sensor pixels</div></div></div></foreignObject><text x="491" y="92" fill="light-dark(#000000, #ffffff)" font-family="&quot;Helvetica&quot;" font-size="12px" text-anchor="middle">Linear sensor pixels</text></switch></g></g></g><g data-cell-id="6"><g><rect x="401" y="113" width="60" height="30" fill="none" stroke="none" pointer-events="all"/></g><g><g transform="translate(-0.5 -0.5)"><switch><foreignObject style="overflow: visible; text-align: left;" pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 58px; height: 1px; padding-top: 128px; margin-left: 402px;"><div style="box-sizing: border-box; font-size: 0; text-align: center; color: #1AFF31; "><div style="display: inline-block; font-size: 12px; font-family: &quot;Helvetica&quot;; color: light-dark(#1AFF31, #007f00); line-height: 1.2; pointer-events: all; white-space: normal; word-wrap: normal; ">Ray of light A</div></div></div></foreignObject><text x="431" y="132" fill="#1AFF31" font-family="&quot;Helvetica&quot;" font-size="12px" text-anchor="middle">Ray of lig...</text></switch></g></g></g><g data-cell-id="7"><g><rect x="471" y="113" width="60" height="30" fill="none" stroke="none" pointer-events="all"/></g><g><g transform="translate(-0.5 -0.5)"><switch><foreignObject style="overflow: visible; text-align: left;" pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 58px; height: 1px; padding-top: 128px; margin-left: 472px;"><div style="box-sizing: border-box; font-size: 0; text-align: center; color: #FF0000; "><div style="display: inline-block; font-size: 12px; font-family: &quot;Helvetica&quot;; color: light-dark(#FF0000, #ff9090); line-height: 1.2; pointer-events: all; white-space: normal; word-wrap: normal; ">Ray of light A</div></div></div></foreignObject><text x="501" y="132" fill="#FF0000" font-family="&quot;Helvetica&quot;" font-size="12px" text-anchor="middle">Ray of lig...</text></switch></g></g></g></g></g></g></svg></diagram> <diagram><svg xmlns="http://www.w3.org/2000/svg" style="background: transparent; background-color: transparent; color-scheme: light dark;" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="931px" height="144px" viewBox="-0.5 -0.5 931 144" content="&lt;mxfile host=&quot;wiki.ostrowski.net.pl&quot; agent=&quot;Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:138.0) Gecko/20100101 Firefox/138.0&quot; version=&quot;26.2.15&quot;&gt;&lt;diagram id=&quot;mRD1LMbev2ZDhoJVxo4r&quot; name=&quot;Page-1&quot;&gt;1VfLjtsgFP0aL0cCk1eXSTpuF61UNYuukbmx0WCwMEmcfn0hxu882iqTUbxI8PHl3Mu5J4YEZJ2VXzTN0++KgQhCxMqAfA5Ce81n9sshxwpZYFIBieasgnALbPhv8CDy6I4zKHqBRilheN4HYyUlxKaHUa3VoR+2VaKfNacJjIBNTMUY/cWZSf0qpqjFvwJP0jozRv5JRutgDxQpZerQgchrQNZaKVONsnINwolX61LNiy48bQrTIM3fTAirCXsqdn5tvi5zrBcLki2dZvYuFrQoeByQVWGoNmM4NZmwALZDrXaSgUuD7F3FCmyka1sobpZvfQMqA6OPNuTQClzrm3a0rTENghq+79NT3+ekoWsy/FDcJg6R9+QLrom8JScz1Oco1E7H4Kd1FR0wzW8RWeUSMCMiO+isu4VODTvfPHK7efFO709NcC3pdFIqCdf6VRit3hpzhw2yVkLpEzWJImSv2gsRd2U+Ra/x/E6tnt0iutBq2wR67ITlLqC4XPBkmGeCrtY1Jf14srgRv7jKbwdVxf/r08mH+hQvo4jgJ/Tpy92MSshjjIqHeW4YFX8aGHV+PT6cvK9RpyOjfuMSqHZeBVkoN8h5CaIYGdhAafpGpYIn0u2O1k1gvbjagzbcHiKW/kHGGXPTV4eUG9jkNHZcB3tkurB9OgIo/9WstXZ4et4DHTM3B6yum8nAK13j9javK8LORsL+PBlLbe2HOOUK0fLBom6VNOfeE/cQe/BDmKKx2LN30nr+BFo3Z4c7aE3Qw7S2t+3RvHq/tH9wyOsf&lt;/diagram&gt;&lt;/mxfile&gt;"><defs/><g><g data-cell-id="0"><g data-cell-id="1"><g data-cell-id="2"><g><path d="M 27.37 73 L 914.63 73" fill="none" stroke="#000000" style="stroke: light-dark(rgb(0, 0, 0), rgb(255, 255, 255));" stroke-miterlimit="10" pointer-events="stroke"/><path d="M 22.12 73 L 29.12 69.5 L 27.37 73 L 29.12 76.5 Z" fill="#000000" style="fill: light-dark(rgb(0, 0, 0), rgb(255, 255, 255)); stroke: light-dark(rgb(0, 0, 0), rgb(255, 255, 255));" stroke="#000000" stroke-miterlimit="10" pointer-events="all"/><path d="M 919.88 73 L 912.88 76.5 L 914.63 73 L 912.88 69.5 Z" fill="#000000" style="fill: light-dark(rgb(0, 0, 0), rgb(255, 255, 255)); stroke: light-dark(rgb(0, 0, 0), rgb(255, 255, 255));" stroke="#000000" stroke-miterlimit="10" pointer-events="all"/></g></g><g data-cell-id="3"><g><path d="M 341 73 Q 641 53 671 23 Q 701 -7 726 23 Q 751 53 841 73" fill="none" stroke="#ff0000" style="stroke: light-dark(rgb(255, 0, 0), rgb(255, 144, 144));" stroke-width="2" stroke-miterlimit="10" pointer-events="stroke"/></g></g><g data-cell-id="4"><g><path d="M 1 73 Q 301 53 331 18 Q 361 -17 386 18 Q 411 53 501 73" fill="none" stroke="#1aff31" style="stroke: light-dark(rgb(26, 255, 49), rgb(0, 127, 0));" stroke-width="2" stroke-miterlimit="10" pointer-events="stroke"/></g></g><g data-cell-id="5"><g><rect x="386" y="73" width="210" height="30" fill="none" stroke="none" pointer-events="all"/></g><g><g transform="translate(-0.5 -0.5)"><switch><foreignObject style="overflow: visible; text-align: left;" pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 208px; height: 1px; padding-top: 88px; margin-left: 387px;"><div style="box-sizing: border-box; font-size: 0; text-align: center; color: #000000; "><div style="display: inline-block; font-size: 12px; font-family: &quot;Helvetica&quot;; color: light-dark(#000000, #ffffff); line-height: 1.2; pointer-events: all; white-space: normal; word-wrap: normal; ">Linear sensor pixels</div></div></div></foreignObject><text x="491" y="92" fill="light-dark(#000000, #ffffff)" font-family="&quot;Helvetica&quot;" font-size="12px" text-anchor="middle">Linear sensor pixels</text></switch></g></g></g><g data-cell-id="6"><g><rect x="401" y="113" width="60" height="30" fill="none" stroke="none" pointer-events="all"/></g><g><g transform="translate(-0.5 -0.5)"><switch><foreignObject style="overflow: visible; text-align: left;" pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 58px; height: 1px; padding-top: 128px; margin-left: 402px;"><div style="box-sizing: border-box; font-size: 0; text-align: center; color: #1AFF31; "><div style="display: inline-block; font-size: 12px; font-family: &quot;Helvetica&quot;; color: light-dark(#1AFF31, #007f00); line-height: 1.2; pointer-events: all; white-space: normal; word-wrap: normal; ">Ray of light A</div></div></div></foreignObject><text x="431" y="132" fill="#1AFF31" font-family="&quot;Helvetica&quot;" font-size="12px" text-anchor="middle">Ray of lig...</text></switch></g></g></g><g data-cell-id="7"><g><rect x="471" y="113" width="60" height="30" fill="none" stroke="none" pointer-events="all"/></g><g><g transform="translate(-0.5 -0.5)"><switch><foreignObject style="overflow: visible; text-align: left;" pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 58px; height: 1px; padding-top: 128px; margin-left: 472px;"><div style="box-sizing: border-box; font-size: 0; text-align: center; color: #FF0000; "><div style="display: inline-block; font-size: 12px; font-family: &quot;Helvetica&quot;; color: light-dark(#FF0000, #ff9090); line-height: 1.2; pointer-events: all; white-space: normal; word-wrap: normal; ">Ray of light A</div></div></div></foreignObject><text x="501" y="132" fill="#FF0000" font-family="&quot;Helvetica&quot;" font-size="12px" text-anchor="middle">Ray of lig...</text></switch></g></g></g></g></g></g></svg></diagram>
 +
 +====== Wyostrzanie poprzez kontrast (pasywne) ======
 +
 +Skrypt w pythonie obliczający sumę wszystkich różnic pomiędzy parami pikseli w obrazku.
 +
 +<code python get_diff_pixel.py>
 +from PIL import Image
 +
 +def main():
 +    img = Image.open("greyscale.png").convert("L")
 +    pixels = list(img.getdata())
 +    n = len(pixels)
 +
 +    total = 0
 +    for i in range(n):
 +        pi = pixels[i]
 +        for j in range(i + 1, n):
 +            total += abs(pi - pixels[j])
 +
 +    print(f"Pixels read: {n}")
 +    print(f"Sum of abs diffs over all pairs: {total}")
 +
 +if __name__ == "__main__":
 +    main()
 +
 +</code>
 +
 +===== Wyniki dla obrazka wyostrzonego =====
 +
 +{{.:pasted:20250521-204417.png}}
 +
 +<code>
 +Pixels read: 11970
 +Sum of abs diffs over all pairs: 4496510654
 +</code>
 +
 +===== Wyniki dla obrazka niewyostrzonego =====
 +
 +{{.:pasted:20250521-204252.png}}
 +
 +<code>
 +Pixels read: 11970
 +Sum of abs diffs over all pairs: 3223391491
 +</code>
 +
 +
 +
  
  
notatki/autofocus.1747850823.txt.gz · ostatnio zmienione: przez administrator