Borbin the 🐱

🔍 Suche...
🔍
Alle Begriffe müssen vorkommen (UND), "Phrase" für exakte Treffer, r"regex" für Muster (oder ').
  • Adapter für Micro 4/3 auf Nikon F

    📅 25. Dezember 2013 · Panorama · ⏱️ 1 min

    Ein selbstgemachter Adapter für FOTGA Micro 4/3 auf Nikon F.

    Die einzelnen Schritte:

    Zuerst wird ein 54mm Loch in eine 12mm Plastikplatte gebohrt:

    Die Platte wird in einen Drehkopf gespannt, um die Außenseite zu erstellen:

    Der untere Halter wird ausgerichtet und auf Maß gefräst:

    Die Seiten werden mit einem 45°-Winkel eingekerbt:

    Der 12mm Schlitz um die obere Platte zu halten:

    Eine Seite wird aufgesägt, um den Adapter festklemmen zu können:

    Ein 3.5mm Loch für das M5 Gewinde:

  • The Tower Panorama

    📅 1. Juni 2013 · Panorama · ⏱️ 3 min

    Unlike a classic 360°×180° panorama, a tower panorama is not taken from a single center point. Imagine yourself on a tower with a viewing platform. You can walk around, but usually you cannot position yourself in the center.

    The way to create a 360° tower panorama is to take multiple segments from each side. Using a fisheye to cover the entire side is not an advantage here. Taking multiple segments is better to allow for more correction of the parallax error.

    Using a wide angle lens, you would take a picture from each side and each corner as illustrated below. The blue shaded triangles is the view taken from the sides and the beige shaded triangles is the view taken from the corners. The grey part is the overlap of the pictures.

    If you walk around the platform of a light tower or any other round platform, you would take equiangular steps. For example, take a picture every 45°.

    Depending on the angle of view of your lens, you take one or more vertical pictures.

    With a 24mm lens, you would need at least two pictures at each position using landscape orientation:

    Here are the segments used for this example of panorama taking from the viewing platform of a tower with a square shape using a 24mm wide angle lens.

    Eight horizontal segments:

    Two vertical segments:

    Two additional pictures were taken to capture the tall building.

    Do not worry about the zenit. Usually you cannot take a full picture of the sky above because of the tower structure but you take a picture of the sky later from any place. You only need to make sure the environment match (weather, clouds, brightness, time of day, sun position).

    With all taken pictures, you stitch them like any other spherical panorama, but there will be stitching errors because of the different position of each picture. If you are using PTGui, there is a very efficient way to make it perfect by using the mask tool. Decide which part you want to keep and paint the conflicting part in red to exclude it. Do not try to correct it with too many control points and individual lens parameters. There is always the possibility to post process using an editor. In this example, I had only three stitching errors around the center which were removed by using the mask feature in PTGui.

    The base of the platform can be patched with an aerial view of the tower or simply colored.

    Using the stereographic projection 'little planet' you can make an impressive view from above:

  • 'Encountered an improper argument.'

    📅 11. März 2013 · Software · ⏱️ 2 min

    Ever run into this error message?

    The error message 'Encountered an improper argument.' is from an uncaught exception in WindowProc.

    In:

    LRESULT CWinApp::ProcessWndProcException(CException* e, const MSG* pMsg)
        e->ReportError(MB_ICONEXCLAMATION|MB_SYSTEMMODAL, nIDP);

    the error message is nIDP = AFX_IDP_INTERNAL_FAILURE:

    #define AFX_IDP_INTERNAL_FAILURE        0xF108      // general failure

    Usually you do not end up here. But there are cases where it happens. I have one example which was difficult to debug: An existing MFC based app upgraded to a ribbon control using a release build with static linking. Dynamic linked release builds and all debug builds are not affected.


    It all starts at the InitInstance()of your app when you load the main frame:

    pFrame->LoadFrame(IDR_MAINFRAME,
      WS_OVERLAPPEDWINDOW | FWS_ADDTOTITLE, NULL,
      NULL);

    Then all the way down the call stack:

    BOOL CFrameWndEx::LoadFrame(UINT nIDResource, DWORD dwDefaultStyle, CWnd* pParentWnd, CCreateContext* pContext)
    
    
    BOOL CFrameWnd::LoadFrame(UINT nIDResource, DWORD dwDefaultStyle,
      CWnd* pParentWnd, CCreateContext* pContext)
    
    BOOL CFrameWnd::Create(LPCTSTR lpszClassName,
      LPCTSTR lpszWindowName,
      DWORD dwStyle,
      const RECT& rect,
      CWnd* pParentWnd,
      LPCTSTR lpszMenuName,
      DWORD dwExStyle,
      CCreateContext* pContext)
    
    BOOL CWnd::CreateEx(DWORD dwExStyle, LPCTSTR lpszClassName,
      LPCTSTR lpszWindowName, DWORD dwStyle,
      int x, int y, int nWidth, int nHeight,
      HWND hWndParent, HMENU nIDorHMenu, LPVOID lpParam)

    until you reach:

    ISOLATION_AWARE_INLINE HWND IsolationAwarePrivatenCv IsolationAwareCreateWindowExW(_In_ DWORD dwExStyle,_In_opt_ LPCWSTR lpClassName,_In_opt_ LPCWSTR lpWindowName,_In_ DWORD dwStyle,_In_ int X,_In_ int Y,_In_ int nWidth,_In_ int nHeight,_In_opt_ HWND hWndParent,_In_opt_ HMENU hMenu,_In_opt_ HINSTANCE hInstance,_In_opt_ LPVOID lpParam)

    At this point you suddenly end up in the exception handler of the WndProc:

    LRESULT AFXAPI AfxCallWndProc(CWnd* pWnd, HWND hWnd, UINT nMsg,
      WPARAM wParam = 0, LPARAM lParam = 0)

    All class names, handles and sizes look alright. The last message is 5, which is a WM_SIZE message with the right lParam value. Usually you get a debug break and know why the exception was raised, but here it seemed a mystery. But a quick compare to a sample app from the templates revealed the solution: The ribbon required additional resources in order to run in a static release build in the .rc file:

    #if !defined(_AFXDLL)
      #include "l.DEU\afxprint.rc"         // Ressourcen für Drucken/Seitenansicht
      #include "l.DEU\afxribbon.rc"        // Ressourcen für MFC-Menüband und -Steuerleiste
    #endif

    (Remove the language prefix 'l.DEU\' with your language code if you are building another language.)

  • Web page with inline image

    📅 7. März 2013 · Software · ⏱️ 3 min

    To add an image to a web page you use the img tag:

    <img src="your-image.png" alt="your-image" />


    But this requires a binary file.

    If you work on an embedded system, a html control with restrictions or simply need one plain html file, you can use images inline. The picture data will be encoded with text characters (base64) and added as a class:

    <style type="text/css">
        .my-picture
        {
            background-image: url(data:image/png;base64, BASE64 DATA );
            height: 24px;
            width: 24px;
            display: block;
        }
    </style>

    Later on, you reference the picture class to display the image:

    <div class="my-picture"></div>



    sample

    Here is a complete HTML sample:

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
        <title>base64 image/png</title>
        <style type="text/css">
            .back-button
            {
                background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAADb0lEQVRIx52WT2hcVRTGf+fORJMgbYVEWv9uhEBa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C5aCJWVL28aYE2gx4Eeq4McFHRYem0RzFk98JigbFAZ9/7vRjj/A6BAc6F41EmIAAAAAElFTkSuQmCC);
                height: 24px;
                width: 24px;
                display: block;
            }
        </style>
    </head>
    <body>
        <p>This is a back button</p>
        <div class="back-button"></div>
    </body>
    </html>

    To convert between picture files and base64 data, you can use these PowerShell lines

    From a file (for example 'p24.png') to base64 data:

    $bin = Get-Content p24.png -Encoding Byte
    $str = [System.Convert]::ToBase64String($bin)

    From base64 data to a file (for example 'p24.png')

    $str = "your BASE64 DATA"
    $bin = [System.Convert]::FromBase64String($str)
    Set-Content p24.png -Encoding Byte -Value $bin

    Simple as that, but keep the image size small.

  • CMFCRibbonBar: change tooltips at runtime

    📅 23. Februar 2013 · Software · ⏱️ 2 min

    Tooltips gets displayed as the string part after the ' ' char of the matching resource. So in case you were wondering why you do not see tooltips in your new ribbon if you use your existing string IDs, add the newline to the string resource. But how to change tooltips of the MFC ribbon bar at runtime?
    Using the OnToolTipNotify does not work with the MFC ribbon bar because no IDs are used.

    But here is a trick to make it work:
    Derive a new class from the CMFCRibbonBar class to override the TTN_NEEDTEXT message.

    class CMyRibbonBar : public CMFCRibbonBar
    {
    protected:
        //{{AFX_MSG(CMyRibbonBar)
        afx_msg BOOL OnNeedTipText(UINT id, NMHDR* pNMH, LRESULT* pResult);
        //}}AFX_MSG
        DECLARE_MESSAGE_MAP()
    };


    Set the TTN_NEEDTEXT message handler.

    BEGIN_MESSAGE_MAP(CMyRibbonBar, CMFCRibbonBar)
        ON_NOTIFY_EX_RANGE(TTN_NEEDTEXT, 0, 0xFFFF, &CMyRibbonBar::OnNeedTipText)
    END_MESSAGE_MAP()


    The new TTN_NEEDTEXT message handler gets the original tooltip text, modify the text and sends back the new tooltip text. The MFC ribbon bar does not send the resource ID of the tool. Because of this, the tooltips are matched by string content.

    BOOL CMyRibbonBar::OnNeedTipText(UINT id, NMHDR* pNMH, LRESULT* pResult)
    {
        static CString strTipText;
    
        // get tooltip text
        BOOL ret = CMFCRibbonBar::OnNeedTipText(id, pNMH, pResult);
    
        LPNMTTDISPINFO pTTDispInfo = (LPNMTTDISPINFO)pNMH;
        strTipText = pTTDispInfo->lpszText;
    
        // modify tooltip text
        CString strRes;
        strRes.LoadString(ID_MY_UI_ELEMENT);
        strRes.TrimLeft(_T('\n'));
    
        if(strTipText == strRes)
        {
            // new content for ID_MY_UI_ELEMENT
            strTipText = "New tool tip\ncontent\n2nd Line";
            pTTDispInfo->lpszText = const_cast<LPTSTR>((LPCTSTR)strTipText);
        }
    
        return ret;
    }


    To set tooltip for the drop down menus, simply get the element via the ID, and use the SetToolTipText API. Here is an example on how it is done for the plugins menu in cPicture:

        // Add the tooltips.
        for (vector<FunctionPlugin>::const_iterator it = CRegisterFunctionPlugin::s_vec_function_plugin.begin(); it != CRegisterFunctionPlugin::s_vec_function_plugin.end(); ++it)
        {
            const UINT i(static_cast<UINT>(it - CRegisterFunctionPlugin::s_vec_function_plugin.begin()));
    
            CMFCRibbonBaseElement* pElement = FindByID(ID_FUNCTION_PLUGINS_START + i, FALSE, TRUE);
            if (pElement)
            {
                pElement->SetToolTipText(it->pluginData.desc);
            }
        }
← Neuere Beiträge Seite 49 von 51 Ältere Beiträge →
ÜBER

Jürgen E
Principal Engineer, Villager, and the creative mind behind lots of projects:
Windows Photo Explorer (cpicture-blog), Android apps AI code rpn calculator and Stockroom, vrlight, 3DRoundview, BitBlog and my github


Blog-Übersicht Chronologisch

KATEGORIEN

Auto • Electronics • Fotografie • Motorrad • Paintings • Panorama • Software • Querbeet


Erstellt mit BitBlog!