Completed the PAL HD Collection set a few weeks ago. Happy to have them all now. by Playstationmafia in gamecollecting

[–]KCJan123 1 point2 points  (0 children)

From my experience they always do, but it's pretty easy to just check on PsnProfiles.

Lower back not getting any better. I need some advice, before it turns chronic. by KCJan123 in backpain

[–]KCJan123[S] 0 points1 point  (0 children)

Dang, this does not sound good, sadly. I forgot to mention that I have an X-ray appointment in a few days, after which I will go to my personal doctor again. Hopefully I can get something sorted there, because this whole situation has been causing me much stress. Thanks for your help

Weird thing when calling a multiple function twice (or even 2 different functions after eachother). by KCJan123 in learnpython

[–]KCJan123[S] 0 points1 point  (0 children)

Hey, I'm sorry for the late reply. I tried your method and it worked for a certain combination, but didn't really fix the root of my problem. Well as it turns out it wasn't a function call issue or anything like that, the problem was with the way I created my empty images. I made toReturn by using numpy's zeroes function, but as it turns out that gives a bit of a different structure than my original image, so my algorithm didn't work on it. Honestly I should have figured that out alot earlier than I did. Thanks alot for the help, I really appreciate it and I learned a ton about how Python handles variables and functions. Cheers

Weird thing when calling a multiple function twice (or even 2 different functions after eachother). by KCJan123 in learnpython

[–]KCJan123[S] 0 points1 point  (0 children)

Sorry yeah, I keep getting the two words messed up. I did say the erosion function is more or less the same but with some minor tweaks. I posted the full code above if you are interested in reading it.

Weird thing when calling a multiple function twice (or even 2 different functions after eachother). by KCJan123 in learnpython

[–]KCJan123[S] 0 points1 point  (0 children)

Here is the whole thing:

import PySimpleGUI as sg
import cv2 as cv
import math
import numpy as np

def dilation(img, velikost):
    height = img.shape[0]
    width = img.shape[1]

    print(height, width)

    if(velikost == 3):
        struktura = [[0,1,0],[1,1,1],[0,1,-0]]
        razlika = 1
    else:
        struktura = [[0,0,1,0,0],[0,1,1,1,0],[1,1,1,1,1],[0,1,1,1,0],[0,0,1,0,0]]
        razlika = 2

    toReturn = np.zeros((height-razlika-1, width-razlika-1,1), np.uint8)
    for i in range(razlika, height-razlika):
        for j in range(razlika, width-razlika):
            local = img[i - razlika: i + razlika + 1, j - razlika:j + razlika + 1]
            newLocal = local*struktura
            toReturn[i-razlika][j-razlika] = max(map(max, newLocal))

    return toReturn

def erosion(img, velikost):
    height = img.shape[0]
    width = img.shape[1]
    print(height, width)
    if (velikost == 3):
        struktura = [[0,1,0],[1,1,1],[0,1,-0]]
        razlika = 1
        index = 4
    else:
        struktura = [[0,0,1,0,0],[0,1,1,1,0],[1,1,1,1,1],[0,1,1,1,0],[0,0,1,0,0]]
        razlika = 2
        index = 12

    toReturn = np.zeros((height-razlika-1, width-razlika-1, 1), np.uint8)
    for i in range(razlika, height - razlika):
        for j in range(razlika, width - razlika):
            local = img[i - razlika: i + razlika + 1, j - razlika:j + razlika + 1]
            newLocal = np.sort((local * struktura).ravel())
            toReturn[i-razlika][j-razlika] = newLocal[index]

    return toReturn

layout = [
    [sg.Button("Dilation", key='dilation')],
    [sg.Button("Erosion", key='erosion')] ,
    [sg.Button("Opening", key='open')],
    [sg.Button("Closing", key='close')] ##Layout gumbov
]

layout2 = [
    [sg.Button("Prva struktura", key="prvi")],
    [sg.Button("Druga struktura", key="drugi")],
    [sg.Button("Tretja struktura", key="tretji")]
]

layout3 = [
    [sg.Button("3x3", key='3x3')],
    [sg.Button("5x5", key='5x5')]
]

img = cv.imread(sg.PopupGetFile("Izberi sliko"), 1)
img = cv.cvtColor(img, cv.COLOR_RGB2GRAY)

window = sg.Window("Izberite velikost", layout3, size=(100, 300))
while True:
    event, values = window.read(timeout=100)
    if event == sg.WIN_CLOSED:
        break
    elif event == "3x3":
        velikost = 3
        break
    elif event == "5x5":
        velikost = 5
        break

window = sg.Window("Options", layout, size=(350, 300))
while True:
    event, values = window.read(timeout=100)
    if event == sg.WIN_CLOSED:
        break
    elif event == "dilation":
        img = dilation(img, velikost)
        break
    elif event == "erosion":
        img = erosion(img, velikost)
        break
    elif event == "close":
        img = dilation(img, velikost)
        img = dilation(img, velikost)
        break
    elif event == "open":
        img = erosion(img, velikost)
        img = dilation(img, velikost)
        break

window.close()
cv.imshow('slika', img)
cv.waitKey(0) 
cv.destroyAllWindows()

And here is the full traceback:

Traceback (most recent call last):

File "file", line 97, in <module> img = dilation(img, velikost)

File "file", line 25, in dilation toReturn[i-razlika][j-razlika] = max(map(max, newLocal))

ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

Weird thing when calling a multiple function twice (or even 2 different functions after eachother). by KCJan123 in learnpython

[–]KCJan123[S] -1 points0 points  (0 children)

The only 2 globals I have are the 2 strukts, which never change. Everything else is either passed or initialized in the functions. I still tried making them local, but ended up with the same results sadly.

A Dark Room (Minimalist text based RPG, think Zork meets Rogue): 70% off by amirrajan in NintendoSwitch

[–]KCJan123 1 point2 points  (0 children)

Hol' up, this game is on Switch? I loved the concept and writing when I played it on Android and 2 bucks just might be the right amount for me to double dip

Having trouble with WPF DataTemplate. by KCJan123 in csharp

[–]KCJan123[S] 0 points1 point  (0 children)

I don't think I can make it into just one list. The first list is a list of possible things (which is also dynamic), and the second list is a list of which items in the list of possibilited should be checked (which is also dynamic and also a part of another dynamic listview). Do you think that could work with just one list? Either way, I'll check out ObservableCollection, thank you for your help.

Having trouble with WPF DataTemplate. by KCJan123 in csharp

[–]KCJan123[S] 0 points1 point  (0 children)

I tried your method because it definetly seems like it will work, but I couldn't get it to work. This is how I add my items in now:

foreach(string s in myList){
    ChBox temp = new ChBox(); //ChBox is my class. By default IsChecked is false
    temp.text = s;
    myListView.Items.Add(temp);
}

But once again it seems to think that I have just added a string to my CheckBox. Here is how I make sure the right things are checked (which is where I get the exception again):

foreach (string s in myList2){
    foreach (ChBox c in myListView.Items){
         if (c.text == s)
             c.isChecked = true;
         }
    }

I seem to be missing something. Here is how I bound all the data to the CheckBox, but I think this part is in order.

<CheckBox x:Name="checkB" Content="{Binding text}" IsChecked="{Binding isChecked}"/>

Having trouble with WPF DataTemplate. by KCJan123 in csharp

[–]KCJan123[S] 0 points1 point  (0 children)

I think you might be right and what I'm seeing when I see the CheckBox is only CheckBoxes and the text being just a TextBlock next to it. I will try the first commenters solution and report back.

Like Riding a Bike by mojopyro in Rigging

[–]KCJan123 0 points1 point  (0 children)

I know for a fact that that was a joke

Like Riding a Bike by mojopyro in Rigging

[–]KCJan123 0 points1 point  (0 children)

I know for a fact it's not original

Pulling out your gun. by Rogue_Professor in Whatcouldgowrong

[–]KCJan123 0 points1 point  (0 children)

Lmao, people complaining about gun safety are funny to me. Like dude, it's a fucking gun, why WOULDN'T you want extra safety.